PHPackages                             marjose123/laravel-numberizer - 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. [Database &amp; ORM](/categories/database)
4. /
5. marjose123/laravel-numberizer

AbandonedArchivedLibrary[Database &amp; ORM](/categories/database)

marjose123/laravel-numberizer
=============================

Laravel package to create autonumber for Eloquent model

1.0.2(9mo ago)14MITPHPCI passing

Since Nov 13Pushed 9mo ago1 watchersCompare

[ Source](https://github.com/MarJose123/Laravel-Numberizer)[ Packagist](https://packagist.org/packages/marjose123/laravel-numberizer)[ Docs](https://github.com/marjose123/laravel-numberizer)[ RSS](/packages/marjose123-laravel-numberizer/feed)WikiDiscussions main Synced 1mo ago

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

Laravel package to create autonumber for Eloquent model
=======================================================

[](#laravel-package-to-create-autonumber-for-eloquent-model)

[![Latest Version on Packagist](https://camo.githubusercontent.com/4ee0a6cc6ffbcfe7938e759458e78f3397645360f659cdb02cd2145e1d24c43f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6d61726a6f73653132332f6c61726176656c2d6e756d626572697a65722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/marjose123/laravel-numberizer)[![GitHub Tests Action Status](https://camo.githubusercontent.com/68dbbc6ed748aa510764441ed6fecf82f7dc36e07a9058fcdca109954f254d9a/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6d61726a6f73653132332f6c61726176656c2d6e756d626572697a65722f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/marjose123/laravel-numberizer/actions?query=workflow%3Arun-tests+branch%3Amain)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/1a78cee8656fe322927e43efe7a6ed2fef33604055b96b5226031463147d909d/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6d61726a6f73653132332f6c61726176656c2d6e756d626572697a65722f6669782d7068702d636f64652d7374796c652d6973737565732e796d6c3f6272616e63683d6d61696e266c6162656c3d636f64652532307374796c65267374796c653d666c61742d737175617265)](https://github.com/marjose123/laravel-numberizer/actions?query=workflow%3A%22Fix+PHP+code+style+issues%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/5374b895eea35ea8473af444a70214b22c7450af80252caf1ebd70217d6286e0/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6d61726a6f73653132332f6c61726176656c2d6e756d626572697a65722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/marjose123/laravel-numberizer)

Introduction
------------

[](#introduction)

`Laravel-Numberizer` is a fork of [laravel-autonumber](https://github.com/alfa6661/laravel-autonumber) with a support of latest laravel version.

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

[](#installation)

You can install the package via composer:

```
composer require marjose123/laravel-numberizer
```

You can publish and run the migrations with:

```
php artisan vendor:publish --tag="numberizer-migrations"
php artisan migrate
```

You can publish the config file with:

```
php artisan vendor:publish --tag="numberizer-config"
```

This is the contents of the published config file:

```
return [
 /*
    * '?' will be replaced with the increment number.
    */
    'placeholder' => '?',
    /*
     * The number of digits in the autonumber
     */
    'length' => (int) 6,
    /*
     *   The Starting Value you want to start the creation of the incremental number
     */
    'startingValue' => (int) 11111
];
```

Usage
-----

[](#usage)

1. Add the `AutoNumber` contracts and add also to your model the `HasNumberizer` concerns.

```
use  \MarJose123\LaravelNumberizer\Contracts\AutoNumber;
use \MarJose123\LaravelNumberizer\Concerns\HasNumberizer;

class Purchase extends Model implements AutoNumber
{
    use HasNumberizer;

    /**
     * Return the autonumber configuration array for this model.
     *
     * @return array
     */
    public function getAutoNumberOptions()
    {
        return [
            'purchase_number' => [
                'format' => 'PO-?', // autonumber format. '?' will be replaced with the generated number.
                'length' => 5 // The number of digits in an autonumber
            ]
        ];
    }

}
```

2. If you want to use `closure` on your format you do so.

```
public function getAutoNumberOptions()
{
    return [
        'purchase_number' => [
            'format' => function () {
                return 'PO-' . \Carbon\Carbon::today()->year . '-?'; // autonumber format. '?' will be replaced with the generated number.
            },
            'length' => 6 // The number of digits in the autonumber
        ]
    ];
}
```

The `purchase_number` will be automatically generated based on the format given when saving the Purchase model.

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

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

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits)

- [MarJose](https://github.com/MarJose123)
- [alfa6661](https://github.com/alfa6661)
- [All Contributors](../../contributors)

Thank you!
----------

[](#thank-you)

- [laravel-autonumber](https://github.com/alfa6661/laravel-autonumber) - For beautiful plugin.

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance56

Moderate activity, may be stable

Popularity5

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity44

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 67.7% 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 ~311 days

Total

3

Last Release

294d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/2fe4f462400792289dae3a62fc6af21c37ff3c59f80d108ffa436b7eaf1b7a90?d=identicon)[marjose](/maintainers/marjose)

---

Top Contributors

[![MarJose123](https://avatars.githubusercontent.com/u/18107626?v=4)](https://github.com/MarJose123 "MarJose123 (21 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (6 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (4 commits)")

---

Tags

laravelMarJose123laravel-numberizer

###  Code Quality

TestsPest

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/marjose123-laravel-numberizer/health.svg)

```
[![Health](https://phpackages.com/badges/marjose123-laravel-numberizer/health.svg)](https://phpackages.com/packages/marjose123-laravel-numberizer)
```

###  Alternatives

[anourvalar/eloquent-serialize

Laravel Query Builder (Eloquent) serialization

11320.2M21](/packages/anourvalar-eloquent-serialize)[spatie/laravel-model-flags

Add flags to Eloquent models

4301.1M1](/packages/spatie-laravel-model-flags)[clickbar/laravel-magellan

This package provides functionality for working with the postgis extension in Laravel.

423715.4k1](/packages/clickbar-laravel-magellan)[dragon-code/laravel-deploy-operations

Performing any actions during the deployment process

240173.5k2](/packages/dragon-code-laravel-deploy-operations)[lacodix/laravel-model-filter

A Laravel package to filter, search and sort models with ease while fetching from database.

17649.9k](/packages/lacodix-laravel-model-filter)[user11001/eloquent-model-generator

Eloquent Model Generator

9763.7k](/packages/user11001-eloquent-model-generator)

PHPackages © 2026

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