PHPackages                             bentools/set - 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. bentools/set

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

bentools/set
============

The Set object lets you store unique values of any type, like in Javascript.

1.1(2y ago)112.3k↓50%MITPHPPHP &gt;=7.4

Since Sep 29Pushed 2y ago1 watchersCompare

[ Source](https://github.com/bpolaszek/set)[ Packagist](https://packagist.org/packages/bentools/set)[ RSS](/packages/bentools-set/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (2)Dependencies (4)Versions (3)Used By (0)

[![Latest Stable Version](https://camo.githubusercontent.com/bb86ba891a0dec51bd338e112cb0eeb3d7aea2d0d6d0da998df7d316ebcc8a98/68747470733a2f2f706f7365722e707567782e6f72672f62656e746f6f6c732f7365742f762f737461626c65)](https://packagist.org/packages/bentools/set)[![License](https://camo.githubusercontent.com/6d0fe1e6793679398e440ce251994a27a2beb4796cd9acf6e214ef07c1ec0c99/68747470733a2f2f706f7365722e707567782e6f72672f62656e746f6f6c732f7365742f6c6963656e7365)](https://packagist.org/packages/bentools/set)[![CI Workflow](https://github.com/bpolaszek/set/actions/workflows/ci.yml/badge.svg)](https://github.com/bpolaszek/set/actions/workflows/ci.yml)[![Coverage](https://camo.githubusercontent.com/0ef0cb8d6e2afb7e120cc10722734e0a4c42aaade283f4bc3feec3ca48c8f6f2/68747470733a2f2f636f6465636f762e696f2f67682f62706f6c61737a656b2f7365742f6272616e63682f6d61696e2f67726170682f62616467652e7376673f746f6b656e3d4c35756c5461796d6274)](https://codecov.io/gh/bpolaszek/set)[![Total Downloads](https://camo.githubusercontent.com/981a3611307e6bae544ec2170a79632d55243ef11187b258f9b600779148ff2f/68747470733a2f2f706f7365722e707567782e6f72672f62656e746f6f6c732f7365742f646f776e6c6f616473)](https://packagist.org/packages/bentools/set)

bentools/set
============

[](#bentoolsset)

Javascript has a convenient way of deduplicating arrays:

```
const items = ['foo', 'bar', 'foo', 'baz'];
console.log([...new Set(items)]); // ['foo', 'bar', 'baz']
```

So why not PHP?

```
use Bentools\Set\Set;

$items = ['foo', 'bar', 'foo', 'baz'];
var_dump([...new Set($items)]); // ['foo', 'bar', 'baz']
```

Shorthand:

```
use function Bentools\Set\set;

$items = ['foo', 'bar', 'foo', 'baz'];
var_dump([...set($items)]); // ['foo', 'bar', 'baz']
```

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

[](#installation)

```
composer require bentools/set
```

Tests
-----

[](#tests)

```
composer test
```

License
-------

[](#license)

MIT.

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity26

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity48

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

Every ~417 days

Total

2

Last Release

909d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/acdd1a8ee0e657ddd06cf11f98a32100ef7121afb8aa270a5b295f5c29c038b3?d=identicon)[bpolaszek](/maintainers/bpolaszek)

---

Top Contributors

[![bpolaszek](https://avatars.githubusercontent.com/u/5569077?v=4)](https://github.com/bpolaszek "bpolaszek (7 commits)")

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/bentools-set/health.svg)

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

###  Alternatives

[mikemccabe/json-patch-php

Produce and apply json-patch objects

1124.9M7](/packages/mikemccabe-json-patch-php)

PHPackages © 2026

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