PHPackages                             vk-php-utils/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. vk-php-utils/ds

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

vk-php-utils/ds
===============

PHP Java-Like Collections (List, Set, Map)

0.0.0(2y ago)03MITPHPPHP ^8.2

Since Aug 3Pushed 2y ago1 watchersCompare

[ Source](https://github.com/kustov-vitalik/php-utils-ds)[ Packagist](https://packagist.org/packages/vk-php-utils/ds)[ RSS](/packages/vk-php-utils-ds/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (6)Versions (2)Used By (0)

php-utils-ds: PHP Java-Like Collections (List, Set, Map)
========================================================

[](#php-utils-ds-php-java-like-collections-list-set-map)

Overview
--------

[](#overview)

php-utils-ds is a PHP library that provides Java-like implementations for List, Set, and Map. It offers data structures such as ArrayList, Set, and Map, which closely resemble their Java counterparts, making it easier for Java developers to work with PHP.

This library is compatible with PHP 8.2 and above.

Features
--------

[](#features)

- `ArrayList`: A dynamic array that provides methods to manipulate and access its elements.
- `Set`: A collection that contains no duplicate elements. It is similar to a mathematical set.
- `Map`: An object that maps keys to values. It cannot contain duplicate keys; each key can map to at most one value.

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

[](#installation)

You can install the php-utils-ds library via Composer. Run the following command:

```
composer require vk-php-utils/ds
```

Usage
-----

[](#usage)

Here are some examples of how to use the php-utils-ds library:

### ArrayList

[](#arraylist)

```
use VKPHPUtils\DS\ArrayList;

$list = new ArrayList(1, 2, 3);
$list->add(4);
$list->remove(2);

foreach ($list as $element) {
    echo $element . PHP_EOL;
}
```

### Set

[](#set)

```
use VKPHPUtils\DS\Set;

$set = new Set(1, 2, 3, 3, 4);
$set->add(5);
$set->remove(2);

foreach ($set as $element) {
    echo $element . PHP_EOL;
}
```

### Map

[](#map)

```
use VKPHPUtils\DS\Map;

/** @var User $user1 **/
$user1 = ...;
/** @var User $user2 **/
$user2 = ...;

/** @var Map $addressMap **/
$addressMap = new Map();
$addressMap->put($user1, new Address('Apple str 18'));
$addressMap[$user2] = new Address('Banana str 19'); // php way

echo $map->get($user1)->street; // Output: Apple str 18

// php way
echo $map[$user1]->street; // Output: Apple str 18
```

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

[](#contributing)

Contributions to the php-utils-ds library are welcome. If you find a bug or want to add a new feature, feel free to open an issue or submit a pull request.

License
-------

[](#license)

php-utils-ds is licensed under the [MIT License](./LICENSE.md).

###  Health Score

21

—

LowBetter than 18% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity3

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity46

Maturing project, gaining track record

 Bus Factor1

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

1065d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1487558?v=4)[Vitaly Kustov](/maintainers/kustov-vitalik)[@kustov-vitalik](https://github.com/kustov-vitalik)

---

Top Contributors

[![kustov-vitalik](https://avatars.githubusercontent.com/u/1487558?v=4)](https://github.com/kustov-vitalik "kustov-vitalik (1 commits)")

---

Tags

phpmapsetcollectionslistdata structuresarraylistjava

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan, Psalm

Type Coverage Yes

### Embed Badge

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

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

###  Alternatives

[phpcollection/phpcollection

General-Purpose Collection Library for PHP

1.0k64.7M34](/packages/phpcollection-phpcollection)[phootwork/collection

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

3928.2M15](/packages/phootwork-collection)[cartalyst/collections

Collection Abstaction library for PHP.

77914.7k5](/packages/cartalyst-collections)[chdemko/sorted-collections

Sorted Collections for PHP &gt;= 8.4

222.7M3](/packages/chdemko-sorted-collections)

PHPackages © 2026

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