PHP code example of andyvanee / synchroversion

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

    

andyvanee / synchroversion example snippets


$sync = new Synchroversion\Synchroversion(dirname(__FILE__), 'syslog');

$sync->setUmask(0007);

$content = $sync->latest();

$sync->exec(function(){
    return 'Hello World!';
});

// Hoard all the versions!
$sync->retainState(10);

// Save my disk space!
$sync->retainState(1);

$sync->retainState(1);
$sync->purgeStateFiles()


// producer.php
ersion\Synchroversion(dirname(__FILE__), 'syslog');

$sync->exec(function () {
    return file_get_contents('/var/log/system.log');
});


// consumer.php
ersion\Synchroversion(dirname(__FILE__), 'syslog');

echo $sync->latest();
bash
while [[ true ]]; do php producer.php; sleep 5; done
bash
php consumer.php