2017 © Pedro Peláez
 

library underscore

Functional programming library for PHP

image

im0rtality/underscore

Functional programming library for PHP

  • Monday, April 4, 2016
  • by Im0rtality
  • Repository
  • 6 Watchers
  • 39 Stars
  • 4,605 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 5 Forks
  • 4 Open issues
  • 14 Versions
  • 0 % Grown

The README.md

Underscore

Build Status Scrutinizer Quality Score Code Coverage SensioLabsInsight, (*1)

Functional programming library for PHP, (*2)

Code example

Library aims to be as easy to use as possible. Here is example of doing some not-so-meaningful operations to show off:, (*3)

    Underscore::from([1,2,3,4,5])
            // convert array format
        ->map(function($num) { return ['number' => $num];})
            // filter out odd elements
        ->filter(function($item) { return ($item['number'] % 2) == 0;})
            // vardump elements
        ->invoke(function($item) { var_dump($item);})
            // changed my mind, I only want numbers
        ->pick('number')
            // add numbers to 1000
        ->reduce(function($sum, $num) { $sum += $num; return $sum; }, 1000)
            // take result
        ->value();
            // 1006

Motivation

Originaly I needed functional programming magic for other project, so had to pick one lib or write my own., (*4)

There is several PHP ports of UnderscoreJS, however none of those fit my requirements (nice code, easy to write, standardized): - brianhaveri/Underscore.php - not maintained, messy code - Anahkiasen/underscore-php - Laravel4 package => incompatible with PSR-2, (*5)

Installation

Via composer:, (*6)

$ composer require im0rtality/underscore:*

Composer docs recommend to use specific version. You can look them up in Releases., (*7)

Documentation

See wiki, (*8)

Tests

Tests generate coverage reports in clover.xml format, (*9)

$ vendor/bin/phpunit

License

MIT License: You can do whatever you want as long as you include the original copyright., (*10)

The Versions

04/04 2016

dev-master

9999999-dev

Functional programming library for PHP

  Sources   Download

MIT

The Requires

  • php >=5.4

 

The Development Requires

04/04 2016

v0.6.1

0.6.1.0

Functional programming library for PHP

  Sources   Download

MIT

The Requires

  • php >=5.4

 

The Development Requires

21/03 2016

v0.6.0

0.6.0.0

Functional programming library for PHP

  Sources   Download

MIT

The Requires

  • php >=5.4

 

The Development Requires

28/02 2016

v0.5.0

0.5.0.0

Functional programming library for PHP

  Sources   Download

MIT

The Requires

  • php >=5.4

 

The Development Requires

10/10 2015

dev-split-tests

dev-split-tests

Functional programming library for PHP

  Sources   Download

MIT

The Requires

  • php >=5.4

 

The Development Requires

05/07 2015

v0.4.0

0.4.0.0

Functional programming library for PHP

  Sources   Download

MIT

The Requires

  • php >=5.4

 

The Development Requires

28/06 2015

v0.3.1

0.3.1.0

Functional programming library for PHP

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

28/06 2015

v0.3.0

0.3.0.0

Functional programming library for PHP

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

11/04 2014

0.2.0

0.2.0.0

Functional programming library for PHP

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

23/03 2014

v0.1.4

0.1.4.0

Functional programming library for PHP

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

14/03 2014

v0.1.3

0.1.3.0

Functional programming library for PHP

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

14/03 2014

v0.1.2

0.1.2.0

Functional programming library for PHP

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

14/03 2014

v0.1.1

0.1.1.0

Functional programming library for PHP

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

11/03 2014

v0.1

0.1.0.0

Functional programming library for PHP

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires