1# Native Data Structures for PHP 2 3[![Build Status](https://github.com/php-ds/ext-ds/workflows/CI/badge.svg)](https://github.com/php-ds/ext-ds/actions?query=workflow%3A%22CI%22+branch%3Amaster) 4[![Build status](https://ci.appveyor.com/api/projects/status/9w0xitp3q04hdu1d?svg=true)](https://ci.appveyor.com/project/rtheunissen/ext-ds) 5[![PECL](https://img.shields.io/badge/PECL-1.5.0-blue.svg)](https://pecl.php.net/package/ds) 6 7A PHP language extension that provides specialized data structures as efficient alternatives to the PHP array. 8You can read about it in more detail [in this blog post](https://medium.com/p/9dda7af674cd) which highlights the API, performance (relative to PHP 7) and other benefits of using the extension. 9 10## Documentation 11 12Documentation is available on [php.net](http://docs.php.net/manual/en/book.ds.php). You should also include the [polyfill](https://github.com/php-ds/polyfill) in your project for IDE integration. 13 14## Installation 15 16The easiest way to install the extension is to use PECL: 17 18``` 19pecl install ds 20``` 21 22If you're on Windows, you can download a compiled .dll on [PECL](https://pecl.php.net/package/ds) or under [releases](https://github.com/php-ds/extension/releases). 23 24## Enabling the extension 25 26You'll need to add `extension=ds.so` to your primary *php.ini* file. 27 28If you encounter an "undefined symbol" error, see [#2](https://github.com/php-ds/extension/issues/2#issuecomment-181855047). 29 30```bash 31# To see where .ini files are located 32php -i | grep "\.ini" 33``` 34 35--- 36 37You can also enable the extension temporarily using the command line: 38 39```bash 40php -d extension=ds.so 41``` 42 43**Note**: Windows would use php_ds.dll instead. 44 45## Testing 46 47There is a suite of PHPUnit tests that can be installed using [**Composer**](https://getcomposer.org/doc/00-intro.md#installation-linux-unix-osx). 48 49``` bash 50composer install # Install the test suite 51composer test # Run the tests 52composer memtest # Run the tests checking for memory leaks 53``` 54 55## Compatibility 56 57You may include the [polyfill](https://github.com/php-ds/polyfill) as a dependency in your project. This allows your codebase to still function in an environment where the extension is not installed. 58 59## Contributing 60 61For local development, I'm using Docker: 62 63``` 64./dev.sh # opens a shell into a development environment 65 66phpize 67./configure 68make 69make install 70 71composer install 72composer test 73``` 74 75Please see [CONTRIBUTING](CONTRIBUTING.md) for more information. 76 77## Credits 78 79- [Rudi Theunissen](https://github.com/rtheunissen) 80- [Joe Watkins](https://github.com/krakjoe) 81 82## License 83 84The MIT License (MIT). Please see [LICENSE](LICENSE) for more information. 85