# Dependencies you might need to install
# sudo apt-get update
# sudo apt-get install -y build-essentials autoconf
# sudo add-apt-repository ppa:ondrej/php
# sudo apt-get install -y php7.0-dev
git clone https://github.com/php-ds/ds "php-ds"
cd php-ds
# Build and install the extension
phpize
./configure
make
sudo make install
# Clean up the build files
phpize --clean
make clean
Windows will be supported when a stable release is on PECL.
php -d extension=ds.so
You can use the Ds
namespace when using a specific structure:
<?php
use Ds\Set;
$set = new Set();
$set->add('a', 2, new \stdClass());
print_r($set);
/*
Ds\Set Object
(
[0] => a
[1] => 2
[2] => stdClass Object
(
)
)
*/
You can also use the ds
static API:
<?php
$vector = ds::vector();
$vector->push('a', 'c', 'd');
$vector->insert(1, 'b');
print_r($vector);
/*
Ds\Vector Object
(
[0] => a
[1] => b
[2] => c
[3] => d
)
*/
See /php/include.
php-ds
comes with a suite of PHPUnit
tests requiring composer
:
composer install
./vendor/bin/phpunit
Please see CONTRIBUTING for details.
The MIT License (MIT). Please see LICENSE for more information.