Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/briandavidclark/ramuda
Functional programming helper library for PHP based on Ramda.js
https://github.com/briandavidclark/ramuda
functional-programming php ramda
Last synced: 2 days ago
JSON representation
Functional programming helper library for PHP based on Ramda.js
- Host: GitHub
- URL: https://github.com/briandavidclark/ramuda
- Owner: briandavidclark
- License: mit
- Created: 2020-09-03T03:15:12.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2023-07-27T11:35:21.000Z (over 1 year ago)
- Last Synced: 2024-11-22T16:38:38.543Z (2 months ago)
- Topics: functional-programming, php, ramda
- Language: PHP
- Homepage:
- Size: 96.7 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# λ ramuda
Functional programming helper library for PHP based on [Ramda.js](https://ramdajs.com/)
As far as I know, this is the most feature complete port of [Ramda.js](https://ramdajs.com/) for PHP with over 350 functions. Also, includes many functions from [Ramda Adjunct](https://char0n.github.io/ramda-adjunct/2.24.0/index.html) and [Ramda Extension](https://ramda-extension.firebaseapp.com/docs/).
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:
```php
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 "{$x['fName']} {$x['lName']}";
}),
R::join(''),
R::wrapWith(['', ''])
);echo $listToSelect($users);
```
Produces the following string:
```htmlJohn Doe
Jane Doe```