GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - php-ds/polyfill: Compatibility polyfill

BranchesTags
Open more actions menu

Latest commit

 

History

241 Commits
241 Commits

Folders and files

NameName
Last commit message
Last commit date
.github/workflows
.github/workflows
 
 
src
src
 
 
tests
tests
 
 
.gitattributes
.gitattributes
 
 
.gitignore
.gitignore
 
 
CHANGELOG.md
CHANGELOG.md
 
 
CONTRIBUTING.md
CONTRIBUTING.md
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
composer.json
composer.json
 
 
phpunit.xml
phpunit.xml
 
 

Repository files navigation

Data Structures for PHP

Build Status Packagist

This is a v2 compatibility polyfill for the extension. You should include this package as a dependency of your project to ensure that your codebase would still be functional in an environment where the extension is not installed. The polyfill will not be loaded if the extension is installed and enabled.

Requires PHP >= 8.2.

Types

  • Ds\Seq -- ordered sequence of values (replaces Vector and Deque from v1)
  • Ds\Map -- ordered map of key-value pairs
  • Ds\Set -- unordered set of unique values
  • Ds\Heap -- configurable heap, max-heap by default
  • Ds\Pair -- readonly key-value pair
  • Ds\Key -- interface for custom key equality (replaces Hashable from v1)

Functional Constructors

Convenience functions are available as an alternative to using new:

\Ds\seq([1, 2, 3]);
\Ds\map(['a' => 1, 'b' => 2]);
\Ds\set([1, 2, 3]);
\Ds\heap([3, 1, 2]);

Install

composer require php-ds/php-ds

You can also require that the extension be installed using ext-ds.

Test

composer install
composer test

Make sure that the ds extension is not enabled, as the polyfill will not be loaded if it is. The test output will indicate whether the extension is active.

Contributing

Please see CONTRIBUTING for more information.

Credits

  • Rudi Theunissen
  • Joe Watkins

License

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

About

Compatibility polyfill

Resources

Readme
MIT license

Contributing

Contributing
Activity
Custom properties

Stars

412 stars

Watchers

18 watching

Forks

49 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.