vaened / php-sequence-generator
Facilitates the generation and autocompletion of a sequential value in the database
Installs: 8 962
Dependents: 1
Suggesters: 0
Security: 0
Stars: 2
Watchers: 1
Forks: 0
Open Issues: 0
Requires
- php: ^8.1
- lambdish/phunctional: ^2.1
Requires (Dev)
- phpunit/phpunit: ^9.3.7
README
Facilitates the generation and autocompletion of a sequential value in the database
// 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);