PHPackages                             mariuszmalek/unique-number-generator - 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. mariuszmalek/unique-number-generator

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

mariuszmalek/unique-number-generator
====================================

Easy creation of unique number for your Eloquent models in Laravel

1.0.0(4y ago)16MITPHPPHP ^7.3|^8.0

Since Oct 15Pushed 3y ago1 watchersCompare

[ Source](https://github.com/mariuszmalek/unique-number-generator)[ Packagist](https://packagist.org/packages/mariuszmalek/unique-number-generator)[ Docs](https://github.com/mariuszmalek/unique-number-generator)[ RSS](/packages/mariuszmalek-unique-number-generator/feed)WikiDiscussions master Synced today

READMEChangelog (1)Dependencies (8)Versions (5)Used By (0)

Unique-Number-Generator
=======================

[](#unique-number-generator)

Easy creation of unique number generator for your Eloquent models in Laravel.

> **NOTE:** These instructions are for the latest version of Laravel.
> If you are using an older version, please install a version of the package that [correlates to your Laravel version](#installation).

- [Installation](#installation)
- [Usage](#usage)
- [Bugs, Suggestions, Contributions and Support](#bugs-suggestions-contributions-and-support)
- [Copyright and License](#copyright-and-license)

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

[](#installation)

Depending on your version of Laravel, you should install a different version of the package.

1. Install the package via Composer:

    ```
    $ composer require mariuszmalek/unique-number-generator:dev-master
    ```

    The package will automatically register its service provider.
2. Optionally, publish the configuration file if you want to change any defaults:

    ```
    php artisan vendor:publish --provider="Malek\UniqueNumberGenerator\ServiceProvider"
    ```

Usage
-----

[](#usage)

Saving a model is easy:

```
$post->number = GeneratorNumber::generateID(Post::class, 'number', 'CLI-', $params);
```

*The first parameter is $model in which we search an existing class, the second is a specific column in the database.*

The next one is the prefix that will be added to the beginning of the result. The last one is the parameters for specific search classes. Only the first two parameters are required

Using traits:

```
use Malek\UniqueNumberGenerator\Numerable;

class Product extends Model
{
    use Numerable;

    /**
     * @return string
     */
    public function uniqueColumn(): string
    {
        return 'number';
    }
}
```

You can add a Trait, so that after creating the model, a new unique number will be automatically created. You also need to add the uniqueColumn function which will contain the name of the column to be used.

Bugs, Suggestions, Contributions and Support
--------------------------------------------

[](#bugs-suggestions-contributions-and-support)

Please use [Github](https://github.com/mariuszmalek/unique-number-generator) for reporting bugs, and making comments or suggestions.

See [CONTRIBUTING.md](CONTRIBUTING.md) for how to contribute changes.

Copyright and License
---------------------

[](#copyright-and-license)

[unique-number-generator](https://github.com/mariuszmalek/unique-number-generator)was written by [Mariusz Malek](https://mariuszmalek.com) and is released under the [MIT License](LICENSE.md).

Copyright (c) 2021 Mariusz Malek

###  Health Score

26

—

LowBetter than 41% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity59

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

1722d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/26696860?v=4)[Mariusz](/maintainers/mariuszmalek)[@mariuszmalek](https://github.com/mariuszmalek)

---

Top Contributors

[![mariuszmalek](https://avatars.githubusercontent.com/u/26696860?v=4)](https://github.com/mariuszmalek "mariuszmalek (17 commits)")

---

Tags

laravelgeneratorlumennumberuniqueunique-number-generator

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/mariuszmalek-unique-number-generator/health.svg)

```
[![Health](https://phpackages.com/badges/mariuszmalek-unique-number-generator/health.svg)](https://phpackages.com/packages/mariuszmalek-unique-number-generator)
```

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3355.3M346](/packages/psalm-plugin-laravel)[api-platform/laravel

API Platform support for Laravel

58171.6k14](/packages/api-platform-laravel)[laravel/pulse

Laravel Pulse is a real-time application performance monitoring tool and dashboard for your Laravel application.

1.7k15.1M132](/packages/laravel-pulse)[mike-bronner/laravel-model-caching

Automatic caching for Eloquent models.

2.4k91.9k1](/packages/mike-bronner-laravel-model-caching)[roots/acorn

Framework for Roots WordPress projects built with Laravel components.

9762.4M131](/packages/roots-acorn)[flarum/core

Delightfully simple forum software.

201.4M2.3k](/packages/flarum-core)

PHPackages © 2026

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