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(8mo ago)0116—0%MITPHPPHP ^8.1

Since Oct 7Pushed 8mo 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 today

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

35

—

LowBetter than 81% of packages

Maintenance59

Moderate activity, may be stable

Popularity12

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity49

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

260d 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

[qcod/laravel-app-settings

A package with UI to store and manage all the settings for your application

34296.3k](/packages/qcod-laravel-app-settings)[alfa6661/laravel-autonumber

Laravel package to create autonumber for Eloquent model

4715.8k](/packages/alfa6661-laravel-autonumber)[binafy/laravel-reactions

React to something in Laravel framework

863.6k](/packages/binafy-laravel-reactions)[mnabialek/laravel-eloquent-filter

Allows filtering Eloquent queries by input filters

2514.4k](/packages/mnabialek-laravel-eloquent-filter)

PHPackages © 2026

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