fusonic/linq 1.0.0

A PHP library inspired by the LINQ 2 Objects extension methods in .NET.

Download .zip Project on GitHub

For a full introduction read my blog post.

LINQ queries offer three main advantages over traditional foreach loops:

  • They are more concise and readable, especially when filtering multiple conditions.

  • They provide powerful filtering, ordering, and grouping capabilities with a minimum of application code.

  • In general, the more complex the operation you want to perform on the data, the more benefit you will realize by using LINQ instead of traditional iteration techniques.

Requirements

fusonic/linq is supported on PHP 5.3 and up.

Installation & Usage

The most flexible installation method is using Composer: Simply create a composer.json file in the root of your project:

{
    "require": {
        "fusonic/linq": "@dev"
    }
}

Install composer and run install command:

curl -s http://getcomposer.org/installer | php
php composer.phar install

Once installed, include vendor/autoload.php in your script to autoload fusonic/linq.

require 'vendor/autoload.php';
use Fusonic\Linq\Linq;

Linq::from(array())->count();

Running tests

You can run the test suite with the following command:

phpunit --bootstrap tests/bootstrap.php .

License

This library is licensed under the MIT license.