PHP code example of sbooker / persistent-pointer

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




use Sbooker\PersistentPointer\Pointer;
use Sbooker\PersistentPointer\Repository;
use Sbooker\PersistentPointer\PointerStorage;

$pointer = new Pointer('name');
$pointer->getValue(); // returns 0

// Increase pointer
$pointer->increaseTo(2); 
$pointer->getValue(); // returns 2

// Decrease pointer
$pointer->increaseTo(1); // throws \InvalidArgumentException