rokde / number-generator
A number generator with placeholders for laravel. It creates various number-based formats like invoice numbers or customer numbers.
Fund package maintenance!
rokde
paypal.me/rok
Buy Me A Coffee
Requires
- php: ^8.2
- illuminate/contracts: ^10.0
- spatie/laravel-package-tools: ^1.14.0
Requires (Dev)
- larastan/larastan: ^2.0.1
- laravel/pint: ^1.0
- nunomaduro/collision: ^7.8
- orchestra/testbench: ^8.8
- pestphp/pest: ^2.20
- pestphp/pest-plugin-arch: ^2.0
- pestphp/pest-plugin-laravel: ^2.0
- phpstan/extension-installer: ^1.1
- phpstan/phpstan-deprecation-rules: ^1.0
- phpstan/phpstan-phpunit: ^1.0
README
A number generator with placeholders. It creates various number-based formats like invoice numbers or customer numbers.
Installation
You can install the package via composer:
composer require rokde/number-generator
Usage
$numberGenerator = new \Rokde\NumberGenerator(); // set placeholders $numberGenerator->set('YYYY', 2024) // static values ->set('index', fn () => str_pad('2', 4, '0', STR_PAD_LEFT)) // dynamic values ->set('iban', new IbanValue('DE02120300000000202051', ' ')) // formatter value // rendering an invoice number echo $numberGenerator->render('INV-{YYYY}-{index}'); // INV-2024-0002 echo $numberGenerator->render('IBAN: {iban}'); // IBAN: DE02 1203 0000 0000 2020 51
Testing
composer test
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
License
The MIT License (MIT). Please see License File for more information.