kilbiller / fphp
A set of auto-curried immutable data-last functions for PHP. Inspired by lodash/fp.
Installs: 5 047
Dependents: 2
Suggesters: 0
Security: 0
Stars: 3
Watchers: 3
Forks: 1
Open Issues: 0
Requires
- php: >=7.0
Requires (Dev)
- consistence/coding-standard: ^2.1
- kahlan/kahlan: ^3.1
- squizlabs/php_codesniffer: ^3.0
README
A set of auto-curried immutable data-last functions for PHP. Inspired by lodash/fp.
Requires php >= 7.0
Why use this ?
- Functions are curried and take data as their last argument so you can easily compose them.
- Enables you to do point-free programming.
- All functions are immutable and have similar interfaces: iteratee-first, data-last with the rest of the parameters in between.
How to install
composer require kilbiller/fphp
Pro tips
-
Functions with an arity of one are also curried so you can avoid using a callable to compose them:
flow(flatten())([1, [2, 3]]) ==> [1, 2, 3]
Tests
To run the tests simply do composer run test
.
You can also check code coverage by running composer run test:coverage
.
Functions
- Collections
- join
- filter
- reject
- map
- reduce
- flatten
- flatMap
- every
- none
- find
- zip
- reverse
- some
- first
- last
- uniq
- uniqWith
- prop
- Function composition
- flow
- compose
- Currying
- curry
- curry1
- curry2
- curry3
- curryN
- Logic
- not
- Functions
- negate
- flip
- Extras
- identity
- concat