PHP code example of pirey / serial-generator

1. Go to this page and download the library: Download pirey/serial-generator library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

pirey / serial-generator example snippets




Pirey\SerialGenerator::first('INV') . PHP_EOL; // INV0000001
echo Pirey\SerialGenerator::next('INV000002', 'INV') . PHP_EOL; // INV000003

// override length
echo Pirey\SerialGenerator::first('PRD', 5) . PHP_EOL; // PRD01
echo Pirey\SerialGenerator::next('INV00002', 'INV', 6) . PHP_EOL; // INV003

// throws InvalidArgumentException when given custom code
echo Pirey\SerialGenerator::next('xf86000ABC', 'INV') . PHP_EOL;