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

ActiveLibrary

guava/laravel-sequence
======================

1.2.0(1y ago)677↓100%2MITPHPPHP ^8.1CI passing

Since Sep 5Pushed 10mo ago1 watchersCompare

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

READMEChangelog (4)Dependencies (4)Versions (5)Used By (0)

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

[](#laravel-sequence)

This is a fork for Laravel 11+ of the original package [nextgen-tech/laravel-sequence](github.com/nextgen-tech/laravel-sequence) with a few minor tweaks / enhancements.

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
- Laravel 11 support
- Laravel 12 support

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

[](#installation)

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

Usage
-----

[](#usage)

```
use Carbon\Carbon;
use Guava\Sequence\Enums\ResetFrequency;
use Guava\Sequence\Models\SequenceRule;
use Guava\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. `\Guava\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 number4`{number:}`generated, ordinal number, padded to the given length. Replace `` by the desired length0004`{day}`, `{DD}`day of passed date with leading zero05`{month}`, `{MM}`month of passed date with leading zero03`{year}`, `{YYYY}`full year of passed date2021`{day_short}`, `{D}`day of passed date without leading zero5`{month_short}`, `{M}`month of passed date without leading zero3`{year_short}`, `{YY}`short year of passed date21Credits
-------

[](#credits)

This package is a fork of [nextgen-tech/laravel-sequence](https://github.com/nextgen-tech/laravel-sequence)

- Credits to the original author [Krzysztof Grabania](https://github.com/Dartui)

###  Health Score

35

—

LowBetter than 80% of packages

Maintenance50

Moderate activity, may be stable

Popularity17

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity51

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 92.3% 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 ~57 days

Total

4

Last Release

439d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/42d872f5f47cd71cfd46c8fbd6ec77a6bfb46d6d9499b5e1f843eb407c07f737?d=identicon)[Skrypt](/maintainers/Skrypt)

---

Top Contributors

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

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[anourvalar/eloquent-serialize

Laravel Query Builder (Eloquent) serialization

11320.2M21](/packages/anourvalar-eloquent-serialize)[namu/wirechat

A Laravel Livewire messaging app for teams with private chats and group conversations.

54324.5k](/packages/namu-wirechat)[statamic-rad-pack/runway

Eloquently manage your database models in Statamic.

135192.6k5](/packages/statamic-rad-pack-runway)

PHPackages © 2026

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