PHPackages                             nextgen-tech/laravel-sequence - 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. nextgen-tech/laravel-sequence

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

nextgen-tech/laravel-sequence
=============================

v1.1.0(4y ago)3467[1 issues](https://github.com/nextgen-tech/laravel-sequence/issues)MITPHPPHP ^7.3|^8.0

Since Jun 17Pushed 4y ago1 watchersCompare

[ Source](https://github.com/nextgen-tech/laravel-sequence)[ Packagist](https://packagist.org/packages/nextgen-tech/laravel-sequence)[ RSS](/packages/nextgen-tech-laravel-sequence/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (7)Versions (3)Used By (0)

Laravel Sequence
================

[](#laravel-sequence)

Generate sequential numbers with pattern (e.g. for invoice numbers)

Features
--------

[](#features)

- Easy integration
- Multiple pattern placeholders
- Support for three most common reset frequencies
- Automatically creating new ordinal number based on reset frequency

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

[](#installation)

```
composer require nextgen-tech/laravel-sequence
```

Usage
-----

[](#usage)

```
use Carbon\Carbon;
use NGT\Laravel\Sequence\Enums\ResetFrequency;
use NGT\Laravel\Sequence\Models\SequenceRule;
use NGT\Laravel\Sequence\SequenceFactory;

/**
 * Create new sequence rule. It needs to be done only once.
 */
SequenceRule::create([
    'type'            => 'invoice',
    'pattern'         => '{number}/COMPANY/{year}',
    'reset_frequency' => ResetFrequency::YEARLY,
]);

/**
 * Make sequence factory via container or DI.
 */
$factory = app(SequenceFactory::class);

/**
 * Create sequence by passing sequence type and date (e.g. issue date of invoice).
 */
$sequence = $factory->create(
    'invoice',
    Carbon::createFromFormat('Y-m-d', '2021-06-01')
);

/**
 * Public methods of sequence.
 */
$ordinal = $sequence->getOrdinalNumber(); // e.g. 21
$number  = $sequence->getNumber();        // e.g. 21/COMPANY/2021
$pattern = $sequence->getPattern();       // e.g. {number}/COMPANY/{year}

/**
 * After use of generated number, manual increment of ordinal number is required.
 */
$sequence->increment();
```

Reset Frequencies
-----------------

[](#reset-frequencies)

Sequences supports three most commonly used reset frequencies. `\NGT\Laravel\Sequence\Enums\ResetFrequency` class should be used when creating new sequence rule.

- `ResetFrequency::YEARLY` - resets ordinal number at the beginning of new year
- `ResetFrequency::MONTHLY` - resets ordinal number at the beginning of new month
- `ResetFrequency::DAILY` - resets ordinal number at the beginning of new day

Pattern Placeholders
--------------------

[](#pattern-placeholders)

PlaceholderDescriptionExample`{number}`generated, ordinal number`{day}`day of passed date with leading zero05`{month}`month of passed date with leading zero03`{year}`full year of passed date2021`{day_short}`day of passed date without leading zero5`{month_short}`month of passed date without leading zero3`{year_short}`short year of passed date21

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance13

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity58

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

Every ~6 days

Total

2

Last Release

1790d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/95dd08b3f7f83eedb53d6a13b37a9c2121336d1ae1615e79d5b274e59d32ead8?d=identicon)[Dartui](/maintainers/Dartui)

---

Top Contributors

[![Dartui](https://avatars.githubusercontent.com/u/2657856?v=4)](https://github.com/Dartui "Dartui (1 commits)")

---

Tags

invoiceslaravelnumbersphpsequence

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/nextgen-tech-laravel-sequence/health.svg)

```
[![Health](https://phpackages.com/badges/nextgen-tech-laravel-sequence/health.svg)](https://phpackages.com/packages/nextgen-tech-laravel-sequence)
```

###  Alternatives

[wireui/wireui

TallStack components

1.8k1.3M16](/packages/wireui-wireui)[livewire/volt

An elegantly crafted functional API for Laravel Livewire.

4195.3M84](/packages/livewire-volt)[ramonrietdijk/livewire-tables

Dynamic tables for models with Laravel Livewire

21147.4k](/packages/ramonrietdijk-livewire-tables)

PHPackages © 2026

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