PHP code example of sbooker / persistent-sequences

1. Go to this page and download the library: Download sbooker/persistent-sequences 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/ */

    

sbooker / persistent-sequences example snippets


class ConcreteAlgorithm implements \Sbooker\PersistentSequences\Algorithm
{
    public function first(): string
    {
        // return first item in sequence
    }
    
    public function next(string $currentValue): string 
    {
        // return next item in sequence
    }
}

class ConcreteWriteStorage implements \Sbooker\PersistentSequences\SequenceWriteStorage
{
    //...
}

$sequenceGenerator =
    new \Sbooker\PersistentSequences\SequenceGenerator(
        new ConcreteWriteStorage(),
        new \Sbooker\TransactionManager\TransactionManager(
            // see sbooker/transaction-manager
        )   
    );

$number = $sequenceGenerator->next('concrete-seq', new ConcreteAlgorithm());