Skip to content

terpomoj/pipe

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🚇 Terpomoj/Pipe

This is an alternatives to the declined PHP Pipe Operator RFC.

The idea was first introduced by Taylor Otwell on Twitter. I added some feature, such as directly call the function on the piping value, and directly accessing attribute of the piping value.

Usage Examples

Basic Usage

pipe('test@example.com')
    (md5(...))
    (fn ($md5) => 'https://gravatar.com/avatar/' . $md5)
    ->endpipe;

Accessing Object Attribute

pipe('test@example.com')
    (GravatarUrl::make(...))
    ->url // `url` is an attribute of GravatarUrl
    ->endpipe;

Calling Object Method

pipe('test@example.com')
    (GravatarUrl::make(...))
    ->size(200) // `size` is a method of GravatarUrl
    ->endpipe;

License

MIT License

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages