PHPackages                             marjose123/laravel-autonumber - 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-autonumber

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

marjose123/laravel-autonumber
=============================

A Fork from alfa6661/laravel-autonumber. Laravel package to create autonumber for Eloquent model

v1.0.1(10mo ago)0116—0%MITPHPPHP ^8.1

Since Oct 7Pushed 10mo agoCompare

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

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

Laravel AutoNumber
==================

[](#laravel-autonumber)

A Fork from `alfa6661/laravel-autonumber`. Laravel package to create autonumber for Eloquent model

Installation
============

[](#installation)

You can install the package via composer:

```
composer require marjose123/laravel-autonumber

```

Publish the default configuration

```
php artisan vendor:publish --provider='Alfa6661\AutoNumber\AutoNumberServiceProvider'

```

Running migration

```
php artisan migrate

```

Usage
=====

[](#usage)

Your Eloquent models should use the `Alfa6661\AutoNumber\AutoNumberTrait` trait

The trait contains an abstract method `getAutoNumberOptions()` that you must implement yourself.

```
use Alfa6661\AutoNumber\AutoNumberTrait;

class Order extends Model
{
    use AutoNumberTrait;

    /**
     * Return the autonumber configuration array for this model.
     *
     * @return array
     */
    public function getAutoNumberOptions()
    {
        return [
            'order_number' => [
                'startingValue' => 11111, // optional if you want to start a different number than 1
                'format' => 'SO.?', // autonumber format. '?' will be replaced with the generated number.
                'length' => 5 // The number of digits in an autonumber
            ]
        ];
    }

}
```

You can also pass a `closure` for the format value.

```
public function getAutoNumberOptions()
{
    return [
        'order_number' => [
            'startingValue' => 11111, // optional if you want to start a different number than 1
            'format' => function () {
                return 'SO/' . date('Ymd') . '/?'; // autonumber format. '?' will be replaced with the generated number.
            },
            'length' => 5 // The number of digits in the autonumber
        ]
    ];
}
```

Saving Model
------------

[](#saving-model)

```
$order = Order::create([
    'customer' => 'Mr. X',
]);
```

The order\_number will be automatically generated based on the format given when saving the Order model.

```
echo $order->order_number;

// SO/20170803/00001
```

License
-------

[](#license)

Laravel-autonumber is open-sourced software licensed under the [MIT license](http://opensource.org/licenses/MIT).

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

[](#contributing)

Please report any issue you find in the issues page. Pull requests are more than welcome.

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance54

Moderate activity, may be stable

Popularity12

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity50

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 67.6% 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 ~270 days

Total

2

Last Release

312d ago

### Community

Maintainers

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

---

Top Contributors

[![alfa6661](https://avatars.githubusercontent.com/u/3650559?v=4)](https://github.com/alfa6661 "alfa6661 (23 commits)")[![MarJose123](https://avatars.githubusercontent.com/u/18107626?v=4)](https://github.com/MarJose123 "MarJose123 (8 commits)")[![dea96](https://avatars.githubusercontent.com/u/32514477?v=4)](https://github.com/dea96 "dea96 (1 commits)")[![wuwx](https://avatars.githubusercontent.com/u/4401?v=4)](https://github.com/wuwx "wuwx (1 commits)")[![yudifaturohman](https://avatars.githubusercontent.com/u/50742212?v=4)](https://github.com/yudifaturohman "yudifaturohman (1 commits)")

---

Tags

laraveleloquent autonumber

### Embed Badge

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

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

###  Alternatives

[anourvalar/eloquent-serialize

Laravel Query Builder (Eloquent) serialization

11320.2M21](/packages/anourvalar-eloquent-serialize)[bavix/laravel-clickhouse

Eloquent model for ClickHouse

72214.1k2](/packages/bavix-laravel-clickhouse)[alfa6661/laravel-autonumber

Laravel package to create autonumber for Eloquent model

4715.9k](/packages/alfa6661-laravel-autonumber)[stayallive/laravel-eloquent-observable

Register Eloquent model event listeners just-in-time directly from the model.

2928.9k7](/packages/stayallive-laravel-eloquent-observable)[mozex/laravel-scout-bulk-actions

A Laravel Scout extension for bulk importing and flushing of all models.

1033.4k](/packages/mozex-laravel-scout-bulk-actions)

PHPackages © 2026

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