项目作者: php-ds

项目描述 :
An extension providing efficient data structures for PHP 7
高级语言: C
项目地址: git://github.com/php-ds/ext-ds.git
创建时间: 2016-02-01T08:05:07Z
项目社区:https://github.com/php-ds/ext-ds

开源协议:MIT License

下载


Native Data Structures for PHP

Build Status
Build status
PECL

A PHP language extension that provides specialized data structures as efficient alternatives to the PHP array.
You can read about it in more detail in this blog post which highlights the API, performance (relative to PHP 7) and other benefits of using the extension.

Documentation

Documentation is available on php.net. You should also include the polyfill in your project for IDE integration.

Installation

The easiest way to install the extension is to use PECL:

  1. pecl install ds

If you’re on Windows, you can download a compiled .dll on PECL or under releases.

Enabling the extension

You’ll need to add extension=ds.so to your primary php.ini file.

If you encounter an “undefined symbol” error, see #2.

  1. # To see where .ini files are located
  2. php -i | grep "\.ini"

You can also enable the extension temporarily using the command line:

  1. php -d extension=ds.so

Note: Windows would use php_ds.dll instead.

Testing

There is a suite of PHPUnit tests that can be installed using Composer.

  1. composer install # Install the test suite
  2. composer test # Run the tests
  3. composer memtest # Run the tests checking for memory leaks

Compatibility

You may 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.

Contributing

For local development, I’m using Docker:

  1. ./dev.sh # opens a shell into a development environment
  2. phpize
  3. ./configure
  4. make
  5. make install
  6. composer install
  7. composer test

Please see CONTRIBUTING for more information.

Credits

License

The MIT License (MIT). Please see LICENSE for more information.