errant/sequential

A Simple Sequential ID Generator

1.0.0 2015-03-12 20:58 UTC

This package is not auto-updated.

Last update: 2024-11-09 18:32:39 UTC


README

Sequential lets you create sequences of ID numbers, optionally formatted.

## Install

With composer:

require "errant/sequential": "1.0.*"

Examples

$sequencer = new \Sequential\Sequence('tcp://10.0.0.1:6379');
$sequencer->reset('test_sequence');
echo $sequencer->getNextID('test_sequence');

You can also format IDs:

function padFormat($sequence) {
    return str_pad($sequence, 5, '0', STR_PAD_LEFT);
}
echo $sequencer->getNextIDFormatted('test_sequence', padFormat);