PHPackages                             maximaster/alterator - 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. maximaster/alterator

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

maximaster/alterator
====================

Alternatives iterator.

v1.0.0(1y ago)04MITPHPPHP ^7.4

Since Aug 23Pushed 1y ago2 watchersCompare

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

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

maximaster/alterator
====================

[](#maximasteralterator)

Alternatives iterator.

```
composer require maximaster/alterator
```

Example
-------

[](#example)

Imagine you have an object with the name "Document (5)" and a user decides to copy it. You need to generate a new name for this copy.

Here's how you can do it using the library:

```
// create the library classes manually or get them from your DI container.
$unusedSeeker = new AlteratorUnsusedSeeker(new PostfixIndexAlterator());

$copyName = $unusedSeeker->suggest(
    // Old name.
    'Document (5)',
    // Your strategy to ensure that the suggested name is not already used.
    static fn (string $alternativeName): bool => $database->exists('
        SELECT 1 FROM documents WHERE NAME = ?
    ', [$alternativeName])
);

// This would be "Document (6)" unless your strategy found it already used.
return $copyName;
```

See other examples in [spec](./spec) folder.

Development
-----------

[](#development)

```
devbox run lint
devbox run test
```

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance34

Infrequent updates — may be unmaintained

Popularity3

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity39

Early-stage or recently created project

 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

633d ago

### Community

Maintainers

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

---

Top Contributors

[![mlavrinenko](https://avatars.githubusercontent.com/u/15840214?v=4)](https://github.com/mlavrinenko "mlavrinenko (1 commits)")

###  Code Quality

Static AnalysisPsalm

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/maximaster-alterator/health.svg)

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

###  Alternatives

[loophp/collection

A (memory) friendly, easy, lazy and modular collection class.

745663.8k13](/packages/loophp-collection)[phpactor/language-server

Generic Language Server Platform

55470.1k6](/packages/phpactor-language-server)

PHPackages © 2026

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