Skip to content

Driky/ds

 
 

Repository files navigation

Efficient data structures for PHP 7

Build Status Build status

Installation

# 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
What about Windows?

Windows will be supported when a stable release is on PECL.

Usage

Enabling the extension
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
)
*/

Docs

See /php/include.

Testing

php-ds comes with a suite of PHPUnit tests requiring composer:

composer install
./vendor/bin/phpunit

Contributing

Please see CONTRIBUTING for details.

Credits

License

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

About

Efficient data structures for PHP 7

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C 50.2%
  • PHP 47.7%
  • C++ 2.1%