PHPackages                             olegkravec/unrepeatable - 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. olegkravec/unrepeatable

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

olegkravec/unrepeatable
=======================

Controlling runs of repeat sensetive functional

1.1.0(5y ago)0128PHPPHP 7.\*

Since Oct 8Pushed 5y ago1 watchersCompare

[ Source](https://github.com/Olegkravec/unrepeatable)[ Packagist](https://packagist.org/packages/olegkravec/unrepeatable)[ RSS](/packages/olegkravec-unrepeatable/feed)WikiDiscussions master Synced 4w ago

READMEChangelog (4)DependenciesVersions (5)Used By (0)

Unrepeatable - repeated command execution preven
================================================

[](#unrepeatable---repeated-command-execution-preven)

Installing
----------

[](#installing)

`composer require olegkravec/unrepeatable "^1"`

- Also if you need you can add file `instances.log` in .gitignore
- Also if there is Laravel project you can set env `PROVIDER_STATES_FILE`, that will change name of instance log file.

Intro
-----

[](#intro)

`Unrepeatable` - must be required in your project if you need control/prevent multiple runs of your functions. For example, you have docker where you need for every `git push` make `php artisan db:seed` - but in this case each of seeders will be executed... Unrepeatable is for preventing this cases, library check if traited class was already runned, and say you about this.

Using
-----

[](#using)

### Case #1 - IUnrepeatable

[](#case-1---iunrepeatable)

```
class GenerateDefaultUsersSeeder extends Seeder
{
    use IUnrepeatable; // Just require me

    public function run()
    {
        User::factory()->count(10)->create();
    }
}

```

In this case `GenerateDefaultUsersSeeder` will be able to run factory only one time. If You will run the seeder again, you will see in your console:

```
Seeding: Database\Seeders\GenerateDefaultUsersSeeder

Already invoked! Skipping...
Seeded:  Database\Seeders\GenerateDefaultUsersSeeder (0.76ms)

```

### Case #2 - Unrepeatable

[](#case-2---unrepeatable)

```
class GenerateDefaultUsersSeeder extends Seeder
{
    use Unrepeatable; // Require me

    /**
     * Run the database seeds.
     *
     * @return void
     */
    public function run()
    {
        if(!$this->isPreviouslyRunned()) // Check where are you need if this class was already runned
            User::factory()->count(10)->create();
    }
}

```

In this case you can check previous runs in the place you need.

Also you can specify key of sensitive functionality for checks, for example:

```
public function run()
    {
        if(!$this->isPreviouslyRunned()) // default check
            User::factory()->count(1000)->create();

        if(!$this->isPreviouslyRunned("10k-clients"))
            Clients::factory()->count(10000)->create();

        if(!$this->isPreviouslyRunned("100k-of-another-models"))
            AnotherModel::factory()->count(100000)->create();
    }

```

In this case will be created 3 checkpoints in your class with different keywords.

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity57

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 ~0 days

Total

4

Last Release

2039d ago

PHP version history (2 changes)1.0PHP 7.3

1.0.1PHP 7.\*

### Community

Maintainers

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

---

Top Contributors

[![Olegkravec](https://avatars.githubusercontent.com/u/22846930?v=4)](https://github.com/Olegkravec "Olegkravec (3 commits)")

### Embed Badge

![Health badge](/badges/olegkravec-unrepeatable/health.svg)

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

###  Alternatives

[yavin/symfony-form-tree

create select field with indentation for tree structure

1591.1k1](/packages/yavin-symfony-form-tree)[spatie/laravel-help-space

Integrate Helpspace in your Laravel app

2333.7k](/packages/spatie-laravel-help-space)

PHPackages © 2026

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