A set of auto-curried immutable data-last functions for PHP. Inspired by lodash/fp.

v1.0.3 2017-10-27 09:21 UTC

This package is auto-updated.

Last update: 2020-06-15 12:56:49 UTC


README

CircleCI codecov

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