There is no license information available for the latest version (v0.3.1) of this package.

A PHP library to manipulate Dictionary datastructure

v0.3.1 2014-12-10 11:33 UTC


Build Status Total Downloads Latest Stable Version

A simple class to manipulate Dictionary datastructures within PHP.

You probably dreamed one day to use objects as array indexes. So, that's what this library does.

$dictionary[new YourClass()] = '';


First, you need composer. Download it :

curl -sS https://getcomposer.org/installer | php

Look if he's installed :

php composer.phar

And then install the project :

php composer.phar install

In the composer.json of your project, add :

"require": {
    "1001pharmacies/dictionary": "0.*"

Usage example

// example.php

require __DIR__.'/vendor/autoload.php';

use Meup\DataStructure\Dictionary;

$term              = new stdClass();
$term->label       = 'Lorem ipsum dolor sit amet';

$definition        = new stdClass();
$definition->label = 'Some sample text in latin';

$dictionary        = new Dictionary();
$dictionary[$term] = $definition;

You could use a dictionary with type restriction.

Running Tests

To run tests, execute the command :

vendor/bin/phing test


You need to use PHP 5.5 (or greater version) to enjoy this library. The Iterator::key() method could not return anything else than a scalar value (read more about this).