PHPackages                             cleaniquecoders/laravel-running-number - 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. cleaniquecoders/laravel-running-number

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

cleaniquecoders/laravel-running-number
======================================

Generate running number when creating new records in your table.

3.0.0(6mo ago)413.7k↓50%2[1 PRs](https://github.com/cleaniquecoders/laravel-running-number/pulls)MITPHPPHP ^8.1 | ^8.2 | ^8.3 | ^8.4CI passing

Since Dec 30Pushed 2mo ago1 watchersCompare

[ Source](https://github.com/cleaniquecoders/laravel-running-number)[ Packagist](https://packagist.org/packages/cleaniquecoders/laravel-running-number)[ Docs](https://github.com/cleaniquecoders/laravel-running-number)[ GitHub Sponsors](https://github.com/cleaniquecoders)[ RSS](/packages/cleaniquecoders-laravel-running-number/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (15)Versions (12)Used By (0)

Laravel Running Number
======================

[](#laravel-running-number)

[![Latest Version on Packagist](https://camo.githubusercontent.com/e245aa7c6f1234bbbb84ec57b614ed9595e54b090130fdd4746c44b3f5fc698f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f636c65616e69717565636f646572732f6c61726176656c2d72756e6e696e672d6e756d6265722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/cleaniquecoders/laravel-running-number)[![GitHub Tests Action Status](https://camo.githubusercontent.com/02b28000a6c848b57d7a813bcae09b0963770a1a5b6732574a7f1cd9f056335e/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f636c65616e69717565636f646572732f6c61726176656c2d72756e6e696e672d6e756d6265722f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/cleaniquecoders/laravel-running-number/actions/workflows/run-tests.yml)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/c36cdc886208cea2e9c071dac58dd112c6221313cbcfb5af95b718642a7e0742/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f636c65616e69717565636f646572732f6c61726176656c2d72756e6e696e672d6e756d6265722f6669782d7374796c696e672e796d6c3f6272616e63683d6d61696e266c6162656c3d636f64652532307374796c65267374796c653d666c61742d737175617265)](https://github.com/cleaniquecoders/laravel-running-number/actions/workflows/fix-styling.yml)[![PHPStan Analysis](https://camo.githubusercontent.com/9fdf345dee687f474781d3afe75254f7c1482f59e87ecc96170c12fc1919cf45/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f636c65616e69717565636f646572732f6c61726176656c2d72756e6e696e672d6e756d6265722f7068707374616e2e796d6c3f6272616e63683d6d61696e266c6162656c3d7068707374616e267374796c653d666c61742d737175617265)](https://github.com/cleaniquecoders/laravel-running-number/actions/workflows/phpstan.yml)[![Total Downloads](https://camo.githubusercontent.com/0f04edcbb8a5cec1580d51a10e3b33c722610aafac4f4e9328eefe6be6b54d47/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f636c65616e69717565636f646572732f6c61726176656c2d72756e6e696e672d6e756d6265722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/cleaniquecoders/laravel-running-number)

Generate sequential running numbers for your Laravel application. Perfect for invoice numbers, order numbers, customer IDs, and any other sequential identifiers you need.

✨ Features
----------

[](#-features)

- 🔢 **Sequential Generation** - Automatic sequential number generation per type
- 💾 **Database Persistence** - Reliable state storage in your database
- 🔄 **Reset Periods** - Automatic reset (daily, monthly, yearly, or never)
- 🔒 **Thread-Safe** - Race condition protection with database transactions
- 🏢 **Multiple Sequences** - Separate sequences per type using scopes
- 🎯 **Custom Starting Numbers** - Start sequences from any number
- 📊 **Range Management** - Set maximum limits with exception handling
- 📅 **Date-Based Formats** - Built-in date presenters for time-organized numbers
- 👁️ **Preview Mode** - Preview next numbers without incrementing
- 📦 **Bulk Generation** - Generate multiple numbers at once atomically
- ⚙️ **Configurable** - Customize padding, formatting, and behavior
- 🆔 **UUID Support** - Built-in UUID support for running number records
- 🏷️ **Native PHP Enums** - Modern PHP 8.1+ enum support with Traitify
- 🔧 **Extensible** - Custom generators and presenters via contracts
- 🚀 **Developer Friendly** - Helper functions, facades, Eloquent trait, Artisan commands, and REST API
- 🎭 **Event System** - Built-in events for auditing and notifications
- 🌐 **REST API** - Optional HTTP endpoints for remote number generation
- 📦 **Wide Compatibility** - Laravel 9-12 &amp; PHP 8.1-8.4

📦 Installation
--------------

[](#-installation)

Install via Composer:

```
composer require cleaniquecoders/laravel-running-number
```

Publish and run migrations:

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

Optionally, publish the configuration:

```
php artisan vendor:publish --tag="running-number-config"
```

> **📖 Detailed Guide**: See the complete [Installation Guide](docs/01-getting-started/01-installation.md) for more information.

🚀 Quick Start
-------------

[](#-quick-start)

### Basic Usage

[](#basic-usage)

```
use CleaniqueCoders\RunningNumber\Enums\Organization;

// Using the helper function
$number = running_number()
    ->type(Organization::PROFILE->value)
    ->generate();
// Output: PROFILE001
```

### In Model Events

[](#in-model-events)

```
use Illuminate\Database\Eloquent\Model;

class Invoice extends Model
{
    protected static function booted()
    {
        static::creating(function ($invoice) {
            $invoice->invoice_number = running_number()
                ->type('invoice')
                ->generate();
        });
    }
}

// Now every invoice automatically gets a sequential number
$invoice = Invoice::create([
    'customer_id' => 1,
    'amount' => 100.00,
]);
// invoice_number: INVOICE001
```

### Custom Formatting

[](#custom-formatting)

```
use CleaniqueCoders\RunningNumber\Contracts\Presenter;

class CustomPresenter implements Presenter
{
    public function format(string $type, int $number): string
    {
        return sprintf('%s-%04d', $type, $number);
    }
}

$number = running_number()
    ->type('invoice')
    ->formatter(new CustomPresenter())
    ->generate();
// Output: INVOICE-0001
```

> **📖 Learn More**: Check out the [Quick Start Guide](docs/01-getting-started/02-quick-start.md) and [Common Scenarios](docs/03-usage/05-common-scenarios.md) for more examples.

📚 Documentation
---------------

[](#-documentation)

Comprehensive documentation is available in the [docs](docs/) directory:

- **[Getting Started](docs/01-getting-started/)** - Installation, quick start, and core concepts
- **[Configuration](docs/02-configuration/)** - Configuration options, types, enums, and models
- **[Usage](docs/03-usage/)** - Helper functions, facades, model integration, and examples
- **[Advanced Features](docs/04-advanced-features/)** - Date formats, scopes, ranges, and more
- **[Development](docs/05-development/)** - Testing, contributing, and development setup

### Quick Links

[](#quick-links)

- [Installation Guide](docs/01-getting-started/01-installation.md)
- [Quick Start](docs/01-getting-started/02-quick-start.md)
- [Common Scenarios](docs/03-usage/05-common-scenarios.md)
- [Date-Based Formats](docs/04-advanced-features/01-date-based-formats.md)
- [Multiple Sequences](docs/04-advanced-features/02-multiple-sequences.md)
- [Custom Starting Numbers](docs/04-advanced-features/03-custom-starting-numbers.md)
- [Number Range Management](docs/04-advanced-features/04-number-range-management.md)
- [Preview &amp; Bulk Generation](docs/04-advanced-features/05-preview-and-batch.md)
- [Upgrade Guide](docs/06-upgrade-guide.md)
- [API Reference](docs/README.md)

🧪 Testing
---------

[](#-testing)

```
composer test
```

See the [Testing Guide](docs/05-development/01-testing.md) for more information.

📝 Changelog
-----------

[](#-changelog)

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

🤝 Contributing
--------------

[](#-contributing)

We welcome contributions! Please see our [Contributing Guide](docs/05-development/02-contributing.md) for details.

🔒 Security
----------

[](#-security)

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

🙏 Credits
---------

[](#-credits)

- [Nasrul Hazim Bin Mohamad](https://github.com/nasrulhazim)
- [All Contributors](../../contributors)

📄 License
---------

[](#-license)

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

###  Health Score

53

—

FairBetter than 97% of packages

Maintenance79

Regular maintenance activity

Popularity31

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity74

Established project with proven stability

 Bus Factor1

Top contributor holds 56.8% 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 ~157 days

Recently: every ~342 days

Total

10

Last Release

187d ago

Major Versions

1.0.4 → 2.0.02022-02-12

2.3.0 → 3.0.02025-11-13

PHP version history (5 changes)1.0.0PHP ^8.0

2.0.0PHP ^8.0|^8.1

2.1.0PHP ^8.1

2.2.0PHP ^8.1 | ^8.2 | ^8.3

2.3.0PHP ^8.1 | ^8.2 | ^8.3 | ^8.4

### Community

Maintainers

![](https://www.gravatar.com/avatar/b57069d0f4b634f65eccc6e5d5848990e25968d45ec2cf46d626c6a4658f944b?d=identicon)[nasrulhazim.m](/maintainers/nasrulhazim.m)

---

Top Contributors

[![nasrulhazim](https://avatars.githubusercontent.com/u/10341422?v=4)](https://github.com/nasrulhazim "nasrulhazim (71 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (32 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (22 commits)")

---

Tags

laravelphprunning-numberlaravelcleaniquecoderslaravel-running-number

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

Type Coverage Yes

### Embed Badge

![Health badge](/badges/cleaniquecoders-laravel-running-number/health.svg)

```
[![Health](https://phpackages.com/badges/cleaniquecoders-laravel-running-number/health.svg)](https://phpackages.com/packages/cleaniquecoders-laravel-running-number)
```

###  Alternatives

[spatie/laravel-data

Create unified resources and data transfer objects

1.8k28.9M627](/packages/spatie-laravel-data)[hirethunk/verbs

An event sourcing package that feels nice.

513162.9k6](/packages/hirethunk-verbs)[worksome/exchange

Check Exchange Rates for any currency in Laravel.

123544.7k](/packages/worksome-exchange)[ralphjsmit/livewire-urls

Get the previous and current url in Livewire.

82270.3k4](/packages/ralphjsmit-livewire-urls)[hydrat/filament-table-layout-toggle

Filament plugin adding a toggle button to tables, allowing user to switch between Grid and Table layouts.

6292.3k1](/packages/hydrat-filament-table-layout-toggle)[ralphjsmit/laravel-helpers

A package containing handy helpers for your Laravel-application.

13704.6k2](/packages/ralphjsmit-laravel-helpers)

PHPackages © 2026

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