PHPackages                             sertxudeveloper/laravel-counters - 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. [Payment Processing](/categories/payments)
4. /
5. sertxudeveloper/laravel-counters

ActiveLibrary[Payment Processing](/categories/payments)

sertxudeveloper/laravel-counters
================================

Manage counters with year and series.

v2.0.0(2mo ago)1913MITPHPPHP ^8.2 || ^8.3 || ^8.4 || ^8.5CI passing

Since Feb 29Pushed 4d ago1 watchersCompare

[ Source](https://github.com/sertxudeveloper/laravel-counters)[ Packagist](https://packagist.org/packages/sertxudeveloper/laravel-counters)[ Docs](https://github.com/sertxudeveloper/laravel-counters)[ Fund](https://buymeacoffee.com/sertxudeveloper)[ GitHub Sponsors](https://github.com/sertxudev)[ RSS](/packages/sertxudeveloper-laravel-counters/feed)WikiDiscussions main Synced 3w ago

READMEChangelog (7)Dependencies (11)Versions (10)Used By (0)

[![Counters](/art/socialcard.png)](/art/socialcard.png)

Laravel Counters
================

[](#laravel-counters)

[![](https://camo.githubusercontent.com/c5c3fb95c7bdae8fc0202fd60015b4a0c3486af27193707cfd2142bc8b824dd9/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f72656c656173652f736572747875646576656c6f7065722f6c61726176656c2d636f756e74657273)](https://camo.githubusercontent.com/c5c3fb95c7bdae8fc0202fd60015b4a0c3486af27193707cfd2142bc8b824dd9/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f72656c656173652f736572747875646576656c6f7065722f6c61726176656c2d636f756e74657273) [![](https://github.com/sertxudeveloper/laravel-counters/actions/workflows/tests.yml/badge.svg)](https://github.com/sertxudeveloper/laravel-counters/actions/workflows/tests.yml/badge.svg) [![](https://camo.githubusercontent.com/739810062fe3992455a969adaef9db57d69c1b04c6b58a9686e267e7a5207556/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f736572747875646576656c6f7065722f6c61726176656c2d636f756e74657273)](https://camo.githubusercontent.com/739810062fe3992455a969adaef9db57d69c1b04c6b58a9686e267e7a5207556/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f736572747875646576656c6f7065722f6c61726176656c2d636f756e74657273) [![](https://camo.githubusercontent.com/2879177f4566edc1e6a80ae2e9c3fe5bcb720e02af4ec44bf4eeab7b258a3f0e/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f7265706f2d73697a652f736572747875646576656c6f7065722f6c61726176656c2d636f756e74657273)](https://camo.githubusercontent.com/2879177f4566edc1e6a80ae2e9c3fe5bcb720e02af4ec44bf4eeab7b258a3f0e/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f7265706f2d73697a652f736572747875646576656c6f7065722f6c61726176656c2d636f756e74657273) [![](https://camo.githubusercontent.com/fca337c796b6159b6da65efc8327807d4d850e485cce2f3797fc18b98a9305cc/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f736572747875646576656c6f7065722f6c61726176656c2d636f756e74657273)](https://camo.githubusercontent.com/fca337c796b6159b6da65efc8327807d4d850e485cce2f3797fc18b98a9305cc/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f736572747875646576656c6f7065722f6c61726176656c2d636f756e74657273) [![](https://camo.githubusercontent.com/e6cf544b2e4d47c9a13aba2e18e45fd942b1432ea90c3d6706a7f522f422fd9e/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6973737565732f736572747875646576656c6f7065722f6c61726176656c2d636f756e74657273)](https://camo.githubusercontent.com/e6cf544b2e4d47c9a13aba2e18e45fd942b1432ea90c3d6706a7f522f422fd9e/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6973737565732f736572747875646576656c6f7065722f6c61726176656c2d636f756e74657273) [![](https://camo.githubusercontent.com/9a15c53189b51836928487584160a14b53421501b946bae708239728ad6ff3a0/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f736572747875646576656c6f7065722f6c61726176656c2d636f756e74657273)](https://camo.githubusercontent.com/9a15c53189b51836928487584160a14b53421501b946bae708239728ad6ff3a0/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f736572747875646576656c6f7065722f6c61726176656c2d636f756e74657273) [![Codecov Test coverage](https://camo.githubusercontent.com/5fadfda9569e45a8cb804de0b6fbd75a4d02ada7e8650f74d4c5aec131fdf01f/68747470733a2f2f696d672e736869656c64732e696f2f636f6465636f762f632f6769746875622f736572747875646576656c6f7065722f6c61726176656c2d636f756e74657273)](https://app.codecov.io/gh/sertxudeveloper/laravel-counters)

Manage counters in your Laravel application.

This package allows you to manage counters in your Laravel application. You can create a counter and increment or decrement it as you need. You can also create a counter with a series or a year, so you can have different counters for different series or years.

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

[](#requirements)

This package requires Laravel 10.0 or higher.

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

[](#installation)

You can install the package via composer:

```
composer require sertxudeveloper/laravel-counters
```

Usage
-----

[](#usage)

First, you should run the migrations:

```
php artisan migrate
```

That's it! You are ready to use the package.

Here is an example of how to use the package:

### Use a basic counter

[](#use-a-basic-counter)

```
use SertxuDeveloper\Counters\Counter;

$counter = Counter::make('INVOICES');

$invoice->number = $counter->next(); // 1
```

### Use a counter with a series

[](#use-a-counter-with-a-series)

```
use SertxuDeveloper\Counters\Counter;

$counter = Counter::make('INVOICES', series: 'N');

$invoice->number = $counter->next(); // 1
$invoice->number = $counter->next(); // 2

$counter = Counter::make('INVOICES', series: 'R');

$invoice->number = $counter->next(); // 1
```

### Use a counter with a year

[](#use-a-counter-with-a-year)

```
use SertxuDeveloper\Counters\Counter;

$counter = Counter::make('INVOICES', year: 2023);

$invoice->number = $counter->next(); // 1
$invoice->number = $counter->next(); // 2

$counter = Counter::make('INVOICES', year: 2024);

$invoice->number = $counter->next(); // 1
```

### Use a counter with a year and a series

[](#use-a-counter-with-a-year-and-a-series)

```
use SertxuDeveloper\Counters\Counter;

$counter = Counter::make('INVOICES', year: 2023, series: 'N');

$invoice->number = $counter->next(); // 1
$invoice->number = $counter->next(); // 2

$counter = Counter::make('INVOICES', year: 2023, series: 'R');

$invoice->number = $counter->next(); // 1

$counter = Counter::make('INVOICES', year: 2024, series: 'N');

$invoice->number = $counter->next(); // 1
```

### Decrement a counter

[](#decrement-a-counter)

```
use SertxuDeveloper\Counters\Counter;

$counter = Counter::make('INVOICES');

$invoice->number = $counter->next(); // 1
$invoice->number = $counter->next(); // 2

$invoice->number = $counter->decrement(); // 1
```

### Custom increment

[](#custom-increment)

```
use SertxuDeveloper\Counters\Counter;

$counter = Counter::make('INVOICES');

$invoice->number = $counter->next(); // 1
$invoice->number = $counter->increment(5); // 6
```

### Custom decrement

[](#custom-decrement)

```
use SertxuDeveloper\Counters\Counter;

$counter = Counter::make('INVOICES');

$invoice->number = $counter->next(); // 1
$invoice->number = $counter->increment(5); // 6

$invoice->number = $counter->decrement(3); // 3
```

Testing
-------

[](#testing)

This package contains tests, you can run them using the following command:

```
composer test
```

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](https://github.com/sertxudeveloper/.github/blob/main/CONTRIBUTING.md) for details.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

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

Credits
-------

[](#credits)

- [Sergio Peris](https://github.com/sertxudev)
- [All Contributors](../../contributors)

License
-------

[](#license)

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

Copyright © 2024 Sertxu Developer

###  Health Score

50

—

FairBetter than 95% of packages

Maintenance94

Actively maintained with recent releases

Popularity18

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor1

Top contributor holds 58.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 ~131 days

Recently: every ~193 days

Total

7

Last Release

60d ago

Major Versions

1.3.0 → v2.0.02026-04-27

PHP version history (4 changes)v1.0.0PHP ^8.2

v1.1.0PHP ^8.1|^8.2|^8.3

v1.2.0PHP ^8.1|^8.2|^8.3|^8.4

v2.0.0PHP ^8.2 || ^8.3 || ^8.4 || ^8.5

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/22801379?v=4)[Sergio Peris](/maintainers/sertxudev)[@sertxudev](https://github.com/sertxudev)

---

Top Contributors

[![sertxudev](https://avatars.githubusercontent.com/u/22801379?v=4)](https://github.com/sertxudev "sertxudev (35 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (25 commits)")

---

Tags

countershacktoberfestinvoicelaravelsertxudeveloperlaravelinvoicecountersseriesyears

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

Type Coverage Yes

### Embed Badge

![Health badge](/badges/sertxudeveloper-laravel-counters/health.svg)

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

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3345.1M337](/packages/psalm-plugin-laravel)[laravel/horizon

Dashboard and code-driven configuration for Laravel queues.

4.1k91.3M280](/packages/laravel-horizon)[illuminate/database

The Illuminate Database package.

2.8k54.1M11.1k](/packages/illuminate-database)[laravel/ai

The official AI SDK for Laravel.

9782.1M162](/packages/laravel-ai)[moonshine/moonshine

Laravel administration panel

1.3k239.9k76](/packages/moonshine-moonshine)[spatie/laravel-health

Monitor the health of a Laravel application

87411.3M153](/packages/spatie-laravel-health)

PHPackages © 2026

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