PHP extension providing specialized data structures as efficient alternatives to the array.
Documentation is available on php.net. You should also include the polyfill in your project for compatibility and IDE integration. The polyfill will not be loaded if the extension is enabled
The easiest way to install the extension is to use PECL:
pecl install ds
You can also build directly from source:
# Dependencies you might need to install
# sudo apt-get install git build-essential php7.0-dev
git clone https://github.com/php-ds/extension "php-ds"
cd php-ds
# Build and install the extension
phpize
./configure
make
make install
# Clean up the build files
make clean
phpize --clean
If you're on Windows, you can download a compiled .dll on PECL.
You'll need to add extension=ds.so
(or .dll if you're on Windows) to your primary ini file.
You can also create a separate ini file for the extension, which allows you to control load order.
# To see where additional .ini files are located
php -i | grep "dir for additional .ini files"
# Create a new .ini file for the extension
echo "extension=ds.so" > /path/to/ini/files/30-ds.ini
You can also enable the extension temporarily using the command line:
php -d extension=ds.so
There is a suite of PHPUnit tests that can be installed using Composer.
composer install
composer test
It's highly recommended that you include the polyfill as a dependency in your project. This allows your codebase to still function in an environment where the extension is not installed.
Please see CONTRIBUTING for more information.
The MIT License (MIT). Please see LICENSE for more information.