PHP code example of vaened / php-sequence-generator
1. Go to this page and download the library: Download vaened/php-sequence-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/ */
vaened / php-sequence-generator example snippets
// Initialize Repository
$defaultRepository = new MysqlRepository(table: 'sequences');
$anotherRepository = new MysqlRepository(table: 'secuencias');
$normalizer = new Normalizer($defaultRepository);
$generator = new Generator();
$resolver = new SequentialIncrementer($normalizer, $generator);
// Define Series
$series = [
Serie::for('number')->alias('invoice'),
new Collection($anotherRepository, [
Serie::for('serie_number')->styles([
new FixedLength(8),
new Prefixed('B')
]),
]),
];
// Make increments
$resolver->resolve('payments', $series);