PHPackages                             nowo-tech/serial-number-bundle - 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. [Templating &amp; Views](/categories/templating)
4. /
5. nowo-tech/serial-number-bundle

ActiveSymfony-bundle[Templating &amp; Views](/categories/templating)

nowo-tech/serial-number-bundle
==============================

Generate and mask serial numbers for invoices, receipts, etc. Pattern-based with context and Twig filter.

v1.0.7(1mo ago)02[1 PRs](https://github.com/nowo-tech/SerialNumberBundle/pulls)MITPHPPHP &gt;=8.1 &lt;8.6CI passing

Since Mar 12Pushed 1mo agoCompare

[ Source](https://github.com/nowo-tech/SerialNumberBundle)[ Packagist](https://packagist.org/packages/nowo-tech/serial-number-bundle)[ Docs](https://github.com/nowo-tech/SerialNumberBundle)[ GitHub Sponsors](https://github.com/HecFranco)[ RSS](/packages/nowo-tech-serial-number-bundle/feed)WikiDiscussions main Synced 3w ago

READMEChangelog (8)Dependencies (22)Versions (10)Used By (0)

Serial Number Bundle
====================

[](#serial-number-bundle)

[![CI](https://github.com/nowo-tech/SerialNumberBundle/actions/workflows/ci.yml/badge.svg)](https://github.com/nowo-tech/SerialNumberBundle/actions/workflows/ci.yml)[![Packagist Version](https://camo.githubusercontent.com/65338b1131b9d9c8599631a647f4f74270d2779ae35fdcd307a10d485e7272e7/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6e6f776f2d746563682f73657269616c2d6e756d6265722d62756e646c652e7376673f7374796c653d666c6174)](https://packagist.org/packages/nowo-tech/serial-number-bundle)[![Packagist Downloads](https://camo.githubusercontent.com/905a8eed1657ff9f94b21a5c87874f3770b0481728359aca3652f2f3cc066e92/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6e6f776f2d746563682f73657269616c2d6e756d6265722d62756e646c652e737667)](https://packagist.org/packages/nowo-tech/serial-number-bundle)[![License](https://camo.githubusercontent.com/7013272bd27ece47364536a221edb554cd69683b68a46fc0ee96881174c4214c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c75652e737667)](LICENSE)[![PHP](https://camo.githubusercontent.com/8e58b490725ac49cc8e463c473173681b324c9d92d7854275a785db013ca3de7/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382e312532422d3737374242343f6c6f676f3d706870)](https://php.net)[![Symfony](https://camo.githubusercontent.com/8fe7de83f11ab7ca74742794be56f9291632c8351a9ae5baea0bc1e9c4eb5a35/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f53796d666f6e792d3625323025374325323037253230253743253230382d3030303030303f6c6f676f3d73796d666f6e79)](https://symfony.com)[![GitHub stars](https://camo.githubusercontent.com/669620f423b17d739ea8c0c7b6511765aa68ac88f7e03dc9048247518a8c4a7d/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73746172732f6e6f776f2d746563682f53657269616c4e756d62657242756e646c652e7376673f7374796c653d736f6369616c266c6162656c3d53746172)](https://github.com/nowo-tech/SerialNumberBundle) [![Coverage](https://camo.githubusercontent.com/cd0704b56f1d56def350b6d0164316307bb2f47834225fd85443b6fb0059bc73/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f436f7665726167652d3130302532352d627269676874677265656e)](#tests-and-coverage)

> ⭐ **Found this useful?** Install from Packagist and give it a star on GitHub.

Symfony bundle to generate and mask serial numbers for invoices, receipts, tickets, etc. Uses a pattern with placeholders (`{year}`, `{prefix}`, `{id}`), a context map, and an optional numeric id padding. Includes a Twig filter to mask the serial for display (e.g. show only last 4 digits).

Features
--------

[](#features)

- **SerialNumberGenerator** service: build serials from `context` (variables), `pattern` (string with `{var}` and `{id}`), and numeric `id` (optional zero-padding).
- **Twig function** `serial_number(context, pattern, id, padding?)`: generate serial in templates.
- **Twig filter** `serial_number_mask(serial, visibleLast?, maskChar?)`: mask a serial leaving only the last N characters visible (e.g. `***************0042`).

Documentation
-------------

[](#documentation)

- [Installation](docs/INSTALLATION.md)
- [Configuration](docs/CONFIGURATION.md)
- [Usage](docs/USAGE.md)
- [Contributing](docs/CONTRIBUTING.md)
- [Changelog](docs/CHANGELOG.md)
- [Upgrading](docs/UPGRADING.md)
- [Release](docs/RELEASE.md)
- [Security](docs/SECURITY.md)
- [Engram](docs/ENGRAM.md)

### Additional documentation

[](#additional-documentation)

- [Demo (Symfony 7 &amp; 8)](demo/README.md) — run `make -C demo up-symfony8` from the bundle root.
- [Demo with FrankenPHP (development and production)](docs/DEMO-FRANKENPHP.md)

Quick example
-------------

[](#quick-example)

```
// In a controller or service
$serial = $this->serialNumberGenerator->generate(
  ['prefix' => 'FAC', 'year' => 2025, 'office' => '01'],
  '{prefix}-{year}-{office}-{id}',
  42,
  5 // id padding → 00042
);
// → "FAC-2025-01-00042"
```

```
{# Generate and mask in Twig #}
{{ serial_number(
  { prefix: 'FAC', year: 2025, office: '01' },
  '{prefix}-{year}-{office}-{id}',
  invoice.id,
  5
)|serial_number_mask(4) }}
{# → "*************0042" #}
```

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

[](#requirements)

- PHP &gt;= 8.1, &lt; 8.6
- Symfony 6.0 | 7.0 | 8.0
- Twig 3.8+ or 4.x

Tests and coverage
------------------

[](#tests-and-coverage)

- Tests: PHPUnit (PHP)
- PHP: 100%

Version policy
--------------

[](#version-policy)

The Composer package name is [`nowo-tech/serial-number-bundle`](https://packagist.org/packages/nowo-tech/serial-number-bundle). Source code and issues are in the GitHub repository [`nowo-tech/SerialNumberBundle`](https://github.com/nowo-tech/SerialNumberBundle).

We follow [Semantic Versioning](https://semver.org/). See [Changelog](docs/CHANGELOG.md) for release notes. Security support by major version is described in the [Security policy](.github/SECURITY.md#supported-versions).

License
-------

[](#license)

MIT. See [LICENSE](LICENSE).

###  Health Score

42

—

FairBetter than 89% of packages

Maintenance92

Actively maintained with recent releases

Popularity3

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity57

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 ~8 days

Recently: every ~14 days

Total

8

Last Release

43d ago

### Community

Maintainers

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

---

Top Contributors

[![HecFranco](https://avatars.githubusercontent.com/u/24323276?v=4)](https://github.com/HecFranco "HecFranco (22 commits)")

---

Tags

symfonybundletwiginvoicepatternreceiptmaskserial number

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan, Rector

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/nowo-tech-serial-number-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/nowo-tech-serial-number-bundle/health.svg)](https://phpackages.com/packages/nowo-tech-serial-number-bundle)
```

PHPackages © 2026

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