briandavidclark / ramuda
Functional programming helper library for PHP based on Ramda.js
v1.0.40
2023-07-27 11:31 UTC
Requires
- php: >=5.6
- ext-json: *
- dev-master
- v1.0.40
- v1.0.39
- v1.0.38
- v1.0.37
- v1.0.36
- v1.0.35
- v1.0.34
- v1.0.33
- v1.0.32
- v1.0.31
- v1.0.30
- v1.0.29
- v1.0.28
- v1.0.27
- v1.0.26
- v1.0.25
- v1.0.24
- v1.0.23
- v1.0.22
- v1.0.21
- v1.0.20
- v1.0.19
- v1.0.18
- v1.0.17
- v1.0.16
- v1.0.15
- v1.0.14
- v1.0.13
- v1.0.12
- v1.0.11
- v1.0.10
- v1.0.9
- v1.0.8
- v1.0.7
- v1.0.6
- v1.0.5
- v1.0.4
- v1.0.3
- v1.0.2
- 1.0.1
- 1.0.0
This package is auto-updated.
Last update: 2025-06-27 16:02:21 UTC
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>