A number generator with placeholders. It creates various number-based formats like invoice numbers or customer numbers.
You can install the package via composer:
composer require rokde/number-generator
$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
composer test
Please see CHANGELOG for more information on what has changed recently.
Please see CONTRIBUTING for details.
Please review our security policy on how to report security vulnerabilities.
The MIT License (MIT). Please see License File for more information.