GithubHelp home page GithubHelp logo

ds's Introduction

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.

ds's People

Contributors

krakjoe avatar rtheunissen avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.