PHPackages                             sokumar2/collections - 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. [Queues &amp; Workers](/categories/queues)
4. /
5. sokumar2/collections

ActiveLibrary[Queues &amp; Workers](/categories/queues)

sokumar2/collections
====================

A set of interfaces for storing and manipulating a collection of objects.

v1.0.0(5mo ago)01MITPHPPHP &gt;=8.0.0CI failing

Since Dec 4Pushed 5mo agoCompare

[ Source](https://github.com/sokumar2/php-ds)[ Packagist](https://packagist.org/packages/sokumar2/collections)[ RSS](/packages/sokumar2-collections/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (1)Versions (3)Used By (0)

PHP
Data Structures

[](#phpdata-structures)

[![Coverage](https://raw.githubusercontent.com/sokumar2/php-collection/refs/heads/master/output/coverage.svg)](https://raw.githubusercontent.com/sokumar2/php-collection/refs/heads/master/output/coverage.svg)[![LICENSE](https://camo.githubusercontent.com/5caa455d8debc46fb23abbadb45a733a937f3910a73fc875c2f7820468e1bb54/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d677265656e)](./LICENSE)[![PHP8](https://camo.githubusercontent.com/6bc9ebe7e4daa18ea881eda55e5302edfee2766d37cf27c5d07c8603d2a8dc14/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d253345253344382e302d626c75653f6c6f676f436f6c6f723d7768697465267374796c653d666c6174)](https://camo.githubusercontent.com/6bc9ebe7e4daa18ea881eda55e5302edfee2766d37cf27c5d07c8603d2a8dc14/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d253345253344382e302d626c75653f6c6f676f436f6c6f723d7768697465267374796c653d666c6174)

A set of interfaces in PHP for storing and manipulating a collection of objects.

- [LinkedList](./src/List/LinkedList.php) A double linked list implementation, *add* is an O(1) operation.
- [ArrayList](./src/List/ArrayList.php) An array backed list gaurantees *set* and *get* by index are O(1) operations, *unset* is O(n).
- [Stack](./src/Stack/Stack.php) A double linked list backed LIFO structure, *push*, *pop* and *peek* are all O(1).
- [Queue](./src/Queue/Queue.php) A double linked list backed FIFO structure, *queue*, *dequeue* and *peek* are all O(1).

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

[](#installation)

```
composer require sokumar2/collections
```

Usage
-----

[](#usage)

### Linked List

[](#linked-list)

You can get an instance of a LinkedList from its factory by calling the `createInstance` method. This ensures that only a concrete implementation of ListInterface is created.

```
$listFactory = new LinkedListFactory();

$linkedList = $listFactory->createInstance();
```

### Laravel

[](#laravel)

When using in a Laravel application, you can define the list service as follows (if not taking help of the provided factory method) to ensure that the instantiation is again tied to its implementation.

```
class ListServiceProvider extends ServiceProvider implements DeferrableProvider
{
    public function register(): void
    {
        $this->app->bind(ListInterface::class, LinkedList::class);
    }

    public function provides(): array
    {
        return [
            ListInterface::class
        ];
    }
}
```

Tests
-----

[](#tests)

```
composer run test
```

For coverage report, make sure you have xdebug extenstion installed.

```
composer run coverage
```

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance70

Regular maintenance activity

Popularity1

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 79.2% 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

Unknown

Total

1

Last Release

166d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/8d87a42c364c5ef592467e9f01fdf83f5a9be227beb3c58b04ff3afb78ffefdb?d=identicon)[sokumar2](/maintainers/sokumar2)

---

Top Contributors

[![sokumar2](https://avatars.githubusercontent.com/u/3523590?v=4)](https://github.com/sokumar2 "sokumar2 (42 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (11 commits)")

---

Tags

arraylistlinkedlistqueuestackqueuestackarraylistLinkedList

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/sokumar2-collections/health.svg)

```
[![Health](https://phpackages.com/badges/sokumar2-collections/health.svg)](https://phpackages.com/packages/sokumar2-collections)
```

###  Alternatives

[php-amqplib/php-amqplib

Formerly videlalvaro/php-amqplib. This library is a pure PHP implementation of the AMQP protocol. It's been tested against RabbitMQ.

4.6k125.3M879](/packages/php-amqplib-php-amqplib)[ramsey/collection

A PHP library for representing and manipulating collections.

1.2k486.0M69](/packages/ramsey-collection)[queue-interop/queue-interop

Promoting the interoperability of MQs objects. Based on Java JMS

48130.5M87](/packages/queue-interop-queue-interop)[phootwork/collection

The phootwork library fills gaps in the php language and provides better solutions than the existing ones php offers.

3924.8M15](/packages/phootwork-collection)[apinstein/jqjobs

Async job manager for PHP.

3220.2k](/packages/apinstein-jqjobs)

PHPackages © 2026

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