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.

1.3.0(9mo ago)1875[1 PRs](https://github.com/sertxudeveloper/laravel-counters/pulls)MITPHPPHP ^8.1|^8.2|^8.3|^8.4CI passing

Since Feb 29Pushed 3mo 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 today

READMEChangelog (6)Dependencies (4)Versions (8)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

43

—

FairBetter than 91% of packages

Maintenance71

Regular maintenance activity

Popularity18

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 63% 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 ~94 days

Recently: every ~118 days

Total

6

Last Release

278d ago

PHP version history (3 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

### Community

Maintainers

![](https://www.gravatar.com/avatar/b211c262b3cf89b6f1e2f2eb42d571fa15d3e8415025899f902ad1645d0c4cef?d=identicon)[sertxudev](/maintainers/sertxudev)

---

Top Contributors

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

---

Tags

countershacktoberfestinvoicelaravelsertxudeveloperlaravelinvoicecountersseriesyears

###  Code Quality

TestsPHPUnit

Code StyleLaravel Pint

### 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

[laraveldaily/laravel-invoices

Missing invoices for Laravel

1.5k1.2M4](/packages/laraveldaily-laravel-invoices)[horstoeko/zugferd-laravel

A library for Laravel-Framework for creating and reading european electronic invoices

3684.4k2](/packages/horstoeko-zugferd-laravel)[omalizadeh/laravel-multi-payment

A driver-based laravel package for online payments via multiple gateways

491.1k](/packages/omalizadeh-laravel-multi-payment)

PHPackages © 2026

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