Skip to content

A number generator with placeholders for laravel. It creates various number-based formats like invoice numbers or customer numbers.

License

Notifications You must be signed in to change notification settings

rokde/number-generator

Repository files navigation

number generator

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

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.

About

A number generator with placeholders for laravel. It creates various number-based formats like invoice numbers or customer numbers.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages