morfu/pipe
最新稳定版本:0.1.1
Composer 安装命令:
composer require morfu/pipe
包简介
Invokable pipeline of functions.
README 文档
README
NOT for production. API is NOT stable.
Why?
Instead of doing
$string = 'SCREAMING_SNAKE_CASE';
$string = strtolower($string);
$words = explode('_', $string);
$words = array_map('ucfirst', $words);
$camelized = implode('', $words);
// => 'ScreamingSnakeCase'
do
flow('SCREAMING_SNAKE_CASE', pipe()
->_('strtolower')
->left('explode', '_')
->left('array_map', 'ucfirst')
->left('implode', ''));
// => 'ScreamingSnakeCase'
For further examples see tests/.
What is Morfu
Morfu (from Ancient Greek: μετᾰμορφόω, metamorphóō, "transform") is a set of pipeline-oriented PHP libraries.
What is Pipe
Pipe is a core library of Morfu that provides pipepline itself and some functions that act on other functions.
Install
Via Composer
$ composer require morfu/pipe
Usage
Import functions
use function Morfu\Pipe\functions\through;
$term = through(" tErm\t", 'trim', 'strtolower', 'ucfirst');
If your PHP version is less than 5.6 you should import parent namespace and use functions with the namespace prefix:
use Morfu\Pipe\functions as f;
$term = f\through(" tErm\t", 'trim', 'strtolower', 'ucfirst');
Testing
$ make test
Security
If you discover any security related issues, please email kilych@zoho.com instead of using the issue tracker.
Credits
License
The MIT License (MIT). Please see License File for more information.
统计信息
- 总下载量: 14
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-11-11