Skip to content

Ashraam/license-generator

Repository files navigation

License number generator

Latest Version on Packagist Total Downloads

This package allows you to create random license numbers style code. You can customize the template and add a prefix or suffix.

Installation

You can install the package via composer:

composer require ashraam/license-generator

Usage

$generator = new \Ashraam\LicenseGenerator\LicenseGenerator();

$generator
    ->prefix('MY-')
    ->template('XXXX-9999-X9X9')
    ->generateOne(); // MY-DESQ-4857-X6P8
    
$generator
    ->suffix('-END')
    ->template('XXXX-9999-X9X9')
    ->generateOne(); // FDIS-4572-D6D3-END

$generator
    ->lowerCase()
    ->template('XXXX-9999-X9X9')
    ->generateOne(); // qspr-5423-f5k9

$generator
    ->template('XXXX-9999')
    ->generateMany(3); // ['GDTS-4585', 'YTRH-5558', 'POGQ-4454']

You can use one of the three methods to generate codes:

  • generateOne(): will return a string
  • generateMany(X): will return an array
  • generate(X): will return a string if X equals 1 or an array

Testing

composer test

Changelog

Please see CHANGELOG for more information what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email romain.bertolucci@gmail.com instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.

PHP Package Boilerplate

This package was generated using the PHP Package Boilerplate by Beyond Code.

About

This package allows you to easily generate license keys with custom templates

Resources

License

Contributing

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages