PHPackages                             php-ds/ext-ds - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. php-ds/ext-ds

ActivePhp-ext[Utility &amp; Helpers](/categories/utility)

php-ds/ext-ds
=============

An extension providing efficient internal data structures as an alternative to arrays

v2.0.0(2mo ago)2.2k2.3k↑67.5%100[27 issues](https://github.com/php-ds/ext-ds/issues)[1 PRs](https://github.com/php-ds/ext-ds/pulls)MITPHPPHP &gt;= 8.2.0CI passing

Since Jul 30Pushed 2mo ago82 watchersCompare

[ Source](https://github.com/php-ds/ext-ds)[ Packagist](https://packagist.org/packages/php-ds/ext-ds)[ RSS](/packages/php-ds-ext-ds/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (10)Dependencies (2)Versions (34)Used By (0)

Native Data Structures for PHP
==============================

[](#native-data-structures-for-php)

[![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)[![PECL](https://camo.githubusercontent.com/b15e1b7ff3494df16e33dd7fbc403946b043392d5d169ffc3daad8fe8ca34e43/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5045434c2d322e302e302d626c75652e737667)](https://pecl.php.net/package/ds)

A PHP language extension that provides specialized data structures as efficient alternatives to the PHP array.

**v2.0** introduces a simplified API with fewer types and copy-on-write (COW) semantics for safe iteration during mutation. The core types are **Seq**, **Map**, **Set**, **Heap**, **Pair**, and **Key**.

You can read about the original motivation for this project [in this blog post](https://medium.com/p/9dda7af674cd).

Documentation
-------------

[](#documentation)

Documentation is available on [php.net](https://www.php.net/manual/en/book.ds.php). Note that the php.net docs may not yet reflect the v2.0 changes. The v2.0 types are:

- **Ds\\Seq** -- unified sequence (replaces Vector, Deque, Stack, and Queue)
- **Ds\\Map** -- ordered dictionary with support for arbitrary keys
- **Ds\\Set** -- ordered set of unique values
- **Ds\\Heap** -- configurable heap with optional comparator (replaces PriorityQueue)
- **Ds\\Pair** -- readonly key-value pair
- **Ds\\Key** -- interface for custom key equality (replaces Hashable)

You should also include the [polyfill](https://github.com/php-ds/polyfill) in your project for IDE integration.

Installation
------------

[](#installation)

Requires **PHP &gt;= 8.2**.

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

```
pecl install ds

```

If 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).

Enabling the extension
----------------------

[](#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](https://github.com/php-ds/extension/issues/2#issuecomment-181855047).

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

---

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

```
php -d extension=ds.so
```

**Note**: Windows would use `php_ds.dll` instead.

Testing
-------

[](#testing)

Tests are split between PHPT tests and PHPUnit shared tests.

```
# PHPT tests (native extension tests)
make test

# PHPUnit shared tests (requires Composer)
composer install
composer test
```

Compatibility
-------------

[](#compatibility)

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

Contributing
------------

[](#contributing)

For local development, I'm using Docker:

```
./dev.sh  # opens a shell into a development environment

phpize
./configure
make
make install

composer install
composer test

```

Please see [CONTRIBUTING](CONTRIBUTING.md) for more information.

Credits
-------

[](#credits)

- [Rudi Theunissen](https://github.com/rtheunissen)
- [Joe Watkins](https://github.com/krakjoe)

License
-------

[](#license)

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

###  Health Score

67

—

FairBetter than 99% of packages

Maintenance84

Actively maintained with recent releases

Popularity49

Moderate usage in the ecosystem

Community33

Small or concentrated contributor base

Maturity87

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 85.6% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~114 days

Recently: every ~395 days

Total

32

Last Release

83d ago

Major Versions

v1.2.8 → 2.0.x-dev2019-04-26

v1.8.0 → v2.0.02026-04-12

### Community

Maintainers

![](https://www.gravatar.com/avatar/761df764fa80c32031884a5dd2376cf7e70c0fa152eaa141fd68f12b4a761b9f?d=identicon)[rtheunissen](/maintainers/rtheunissen)

---

Top Contributors

[![rtheunissen](https://avatars.githubusercontent.com/u/809191?v=4)](https://github.com/rtheunissen "rtheunissen (429 commits)")[![simPod](https://avatars.githubusercontent.com/u/327717?v=4)](https://github.com/simPod "simPod (18 commits)")[![rudi-augment](https://avatars.githubusercontent.com/u/240759057?v=4)](https://github.com/rudi-augment "rudi-augment (8 commits)")[![ndossche](https://avatars.githubusercontent.com/u/7771979?v=4)](https://github.com/ndossche "ndossche (7 commits)")[![dktapps](https://avatars.githubusercontent.com/u/14214667?v=4)](https://github.com/dktapps "dktapps (6 commits)")[![Jan-E](https://avatars.githubusercontent.com/u/1757825?v=4)](https://github.com/Jan-E "Jan-E (5 commits)")[![remicollet](https://avatars.githubusercontent.com/u/270445?v=4)](https://github.com/remicollet "remicollet (4 commits)")[![dantudor](https://avatars.githubusercontent.com/u/1281127?v=4)](https://github.com/dantudor "dantudor (3 commits)")[![rvanvelzen](https://avatars.githubusercontent.com/u/102603?v=4)](https://github.com/rvanvelzen "rvanvelzen (3 commits)")[![krakjoe](https://avatars.githubusercontent.com/u/2236138?v=4)](https://github.com/krakjoe "krakjoe (2 commits)")[![asp24](https://avatars.githubusercontent.com/u/488588?v=4)](https://github.com/asp24 "asp24 (2 commits)")[![nikic](https://avatars.githubusercontent.com/u/216080?v=4)](https://github.com/nikic "nikic (1 commits)")[![NoodlesNZ](https://avatars.githubusercontent.com/u/1063979?v=4)](https://github.com/NoodlesNZ "NoodlesNZ (1 commits)")[![siimsoni](https://avatars.githubusercontent.com/u/1738636?v=4)](https://github.com/siimsoni "siimsoni (1 commits)")[![jfcherng](https://avatars.githubusercontent.com/u/6594915?v=4)](https://github.com/jfcherng "jfcherng (1 commits)")[![assertchris](https://avatars.githubusercontent.com/u/200609?v=4)](https://github.com/assertchris "assertchris (1 commits)")[![BenMorel](https://avatars.githubusercontent.com/u/1952838?v=4)](https://github.com/BenMorel "BenMorel (1 commits)")[![cmb69](https://avatars.githubusercontent.com/u/2306138?v=4)](https://github.com/cmb69 "cmb69 (1 commits)")[![colinmollenhour](https://avatars.githubusercontent.com/u/38738?v=4)](https://github.com/colinmollenhour "colinmollenhour (1 commits)")[![glensc](https://avatars.githubusercontent.com/u/199095?v=4)](https://github.com/glensc "glensc (1 commits)")

---

Tags

data-structuresextensionpeclphp

### Embed Badge

![Health badge](/badges/php-ds-ext-ds/health.svg)

```
[![Health](https://phpackages.com/badges/php-ds-ext-ds/health.svg)](https://phpackages.com/packages/php-ds-ext-ds)
```

###  Alternatives

[helthe/turbolinks-bundle

Turbolinks bundle for Symfony

3861.3k](/packages/helthe-turbolinks-bundle)[link1st/laravel-easemob

环信即时通讯laravel包开发，用于环信用户、群、聊天室等功能

446.6k](/packages/link1st-laravel-easemob)[victor-teles/playwright-php

A Playwright bridge for PHP.

205.2k](/packages/victor-teles-playwright-php)[owenmelbz/https-enforcement

Laravel 5.x middleware to enforce https redirection for your app.

252.6k](/packages/owenmelbz-https-enforcement)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
