A set of auto-curried immutable data-last functions for PHP. Inspired by lodash/fp.
Requires php >= 7.0
- 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.
composer require kilbiller/fphp
-
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]
To run the tests simply do composer run test
.
You can also check code coverage by running composer run test:coverage
.
- 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