This is a v2 compatibility polyfill for the extension. You should include this package as a dependency of your project to ensure that your codebase would still be functional in an environment where the extension is not installed. The polyfill will not be loaded if the extension is installed and enabled.
Requires PHP >= 8.2.
Ds\Seq-- ordered sequence of values (replaces Vector and Deque from v1)Ds\Map-- ordered map of key-value pairsDs\Set-- unordered set of unique valuesDs\Heap-- configurable heap, max-heap by defaultDs\Pair-- readonly key-value pairDs\Key-- interface for custom key equality (replaces Hashable from v1)
Convenience functions are available as an alternative to using new:
\Ds\seq([1, 2, 3]);
\Ds\map(['a' => 1, 'b' => 2]);
\Ds\set([1, 2, 3]);
\Ds\heap([3, 1, 2]);composer require php-ds/php-dsYou can also require that the extension be installed using ext-ds.
composer install
composer test
Make sure that the ds extension is not enabled, as the polyfill will not be loaded if it is. The test output will indicate whether the extension is active.
Please see CONTRIBUTING for more information.
The MIT License (MIT). Please see LICENSE for more information.