Skip to content
This repository was archived by the owner on Feb 14, 2023. It is now read-only.

emonkak/underbar.php

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Underbar.php Build Status

Underbar.php is a collection processing library for PHP, like underscore.js.

However not aim full compatibility of undersocre.js.

Requirements

Licence

MIT Licence

Getting Started

  1. Install Composer.
  2. Create the composer.json
  3. Execute composer.phar install

composer.json

{
    "require": {
        "emonkak/underbar.php": "dev-master"
    }
}

Example

// There are also ArrayImpl and GeneratorImpl.
use Underbar\IteratorImpl as _;

// Take five elements from a infinite list of even numbers.
_::chain(0)
    ->iterate(function($n) { return $n + 1; })
    ->filter(function($n) { return $n % 2 === 0; })
    ->take(5)
    ->each(function($n) { echo $n, PHP_EOL; });
// => 0
//    2
//    4
//    6
//    8

// Get a first element.
echo _::first(array(100)), PHP_EOL;
// => 100

API Reference

See http://emonkak.github.io/underbar.php/

About

This library is deprecated, please use emonkak/collection

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •