PHPackages                             cosmicvibes/laraseries - 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. cosmicvibes/laraseries

ActiveLibrary

cosmicvibes/laraseries
======================

Number series package for Laravel

0427[1 issues](https://github.com/cosmicvibes/laraseries/issues)PHP

Since May 10Pushed 7y ago1 watchersCompare

[ Source](https://github.com/cosmicvibes/laraseries)[ Packagist](https://packagist.org/packages/cosmicvibes/laraseries)[ RSS](/packages/cosmicvibes-laraseries/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

[![Latest Stable Version](https://camo.githubusercontent.com/ee155bd41d8c2b3b45f60de9524a6536f0ecd0c20b358a3bd7454fa6e0d1bc53/68747470733a2f2f706f7365722e707567782e6f72672f636f736d696376696265732f6c6172617365726965732f762f737461626c65)](https://packagist.org/packages/cosmicvibes/laraseries)[![Latest Unstable Version](https://camo.githubusercontent.com/db8d50958794eaca630aef6626a6b98b0e4fe9f4759620e0c8d616e0b65d1c3a/68747470733a2f2f706f7365722e707567782e6f72672f636f736d696376696265732f6c6172617365726965732f762f756e737461626c65)](https://packagist.org/packages/cosmicvibes/laraseries)[![Total Downloads](https://camo.githubusercontent.com/cd4693d98fd83ddc900a0d73cbb97181a7b421a3858b8be5bcd2337fc6c0634d/68747470733a2f2f706f7365722e707567782e6f72672f636f736d696376696265732f6c6172617365726965732f646f776e6c6f616473)](https://packagist.org/packages/cosmicvibes/laraseries)[![License](https://camo.githubusercontent.com/d63ca18030b46b8f4f5ea930bc07c4cb4b83fb80db307d4209a600dd80eea688/68747470733a2f2f706f7365722e707567782e6f72672f636f736d696376696265732f6c6172617365726965732f6c6963656e7365)](https://packagist.org/packages/cosmicvibes/laraseries)[![StyleCI](https://camo.githubusercontent.com/b609f60f5aa248dfffbe00b23b7c009aa951ea6401141093a6531e210eb6ae4b/68747470733a2f2f7374796c6563692e696f2f7265706f732f3138353832333036342f736869656c643f6272616e63683d6d6173746572)](https://styleci.io/repos/185823064)[![Build Status](https://camo.githubusercontent.com/6b0d6bd0fb8d6a598bc935c3cd91e33ed70534d538a030fb8bda7dc52e755c2b/68747470733a2f2f7472617669732d63692e6f72672f636f736d696376696265732f6c6172617365726965732e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/cosmicvibes/laraseries)

Laraseries: Laravel Number Series Package
=========================================

[](#laraseries-laravel-number-series-package)

I had a business requirement to create an incrementing part number for products, that cannot be reused. E.g: first item: IN00001, next item IN00002 etc.

This package simplifies the creation of multiple number series and allows you to easily retrieve the next available number, saving the incremented value to the number series. It uses database transactions to ensure the next number is always atomic.

Requirements
------------

[](#requirements)

- PHP 7.1.3+
- Laravel 5.8+

Will likely work on other versions, but is untested.

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

[](#installation)

1. Install the package by running this command in your terminal/cmd:

```
composer require cosmicvibes/laraseries dev-master

```

Usage
-----

[](#usage)

Implements Laravel Eloquent models. A demo application with tests can be found at:

First create a number series:

```
$numberSeries = new Cosmicvibes\Laraseries\NumberSeries();

$numberSeries->fill([
            'code'              => 'TEST',
            'name'              => 'Test Number Series',
            'prefix'            => 'TEST',
            'suffix'            => 'Y',
            'length'            => 10,
            'increment_by'      => 1,
            'padding_character' => 0, // Can be anything
            'start_date'        => Carbon::createFromFormat('d/m/Y', '01/01/2001'), // Can be left blank, implement checks in your own code
            'end_date'          => null, // Can be left blank, implement checks in your own code
            'active'            => true, // For your reference, implement checks in your own code
            'starting_number'   => 1, // Defaults to 0
            'ending_number'     => null, // Defaults to max possible number based on length
]);

$numberSeries->save();

```

Or find an existing model (any eloquent commands will work, see the [Laravel documentation](https://laravel.com/docs/5.8/eloquent) for more details):

```
$numberSeries = NumberSeries::whereCode('TEST')->get()->first();

```

Retrieve the current number:

```
echo $numberSeries->current;
TEST0000000001Y

```

Advance to the next number (the function will return the new current number):

```
$currentNumber = $numberSeries->advance():
TEST0000000002Y

```

Advance by a set amount:

```
$currentNumber = $numberSeries->advance(15):
TEST00000000017Y

```

Note that if you advance past the ending number then advancing further will return null. It is recommended that you implement checking for this situation.

Authors
-------

[](#authors)

- [**Charlie Pearce**](https://github.com/cosmicvibes) - *Initial work*

See also the list of [contributors](https://github.com/cosmicvibes/laraseries/graphs/contributors) who participated in this project.

License
-------

[](#license)

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.

Special Thanks to
-----------------

[](#special-thanks-to)

- [Laravel](https://laravel.com) Community

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity37

Early-stage or recently created project

 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/7a53b3b6c2e10d88ecbdafe52f0e2f3099207ad98e6f68cab848ac13828cd277?d=identicon)[cosmicvibes](/maintainers/cosmicvibes)

---

Top Contributors

[![cosmicvibes](https://avatars.githubusercontent.com/u/286965?v=4)](https://github.com/cosmicvibes "cosmicvibes (2 commits)")

### Embed Badge

![Health badge](/badges/cosmicvibes-laraseries/health.svg)

```
[![Health](https://phpackages.com/badges/cosmicvibes-laraseries/health.svg)](https://phpackages.com/packages/cosmicvibes-laraseries)
```

PHPackages © 2026

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