rokde/number-generator

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

1.0.0 2024-01-09 16:59 UTC

This package is auto-updated.

Last update: 2024-11-05 07:52:20 UTC


README

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.