briandavidclark/ramuda
Composer 安装命令:
composer require briandavidclark/ramuda
包简介
Functional programming helper library for PHP based on Ramda.js
关键字:
README 文档
README
Functional programming helper library for PHP based on Ramda.js
As far as I know, this is the most feature complete port of Ramda.js for PHP with over 350 functions. Also, includes many functions from Ramda Adjunct and Ramda Extension.
In addition, where possible, some of the functions have improved capabilities, such as filter and map handling strings and objects as well as the usual arrays.
Requires PHP 5.6 or higher.
Usage example:
use ramuda\R; $users = [ ['id'=>'45', 'fName'=>'Jane', 'lName'=>'Doe'], ['id'=>'22', 'fName'=>'John', 'lName'=>'Doe'], ['id'=>'99', 'fName'=>'John', 'lName'=>'Smith'] ]; $listToSelect = R::pipe( R::filter(R::propEq('lName', 'Doe')), R::sortBy(R::prop('id')), R::map(function($x){ return "<option value='{$x['id']}'>{$x['fName']} {$x['lName']}</option>"; }), R::join(''), R::wrapWith(['<select>', '</select>']) ); echo $listToSelect($users);
Produces the following string:
<select> <option value="22">John Doe</option> <option value="45">Jane Doe</option> </select>
统计信息
- 总下载量: 42
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2021-12-01