1. Go to this page and download the library: Download amegatron/php-sync 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/ */
amegatron / php-sync example snippets
// $lock is an instance of LockInterface which is associated with a specific Lock called 'pause'
$lock->wait();
// further execution is blocked until the Lock is released
// $lock is an instance of LockInterface which is associated with a specific Lock called 'pause'
$lock->lock();
$lock->unlock();
if ($lock->exists()) {
// ...
}
// $integers is an instance of IntegerInterface associated with 'progress'
$integer->increment(1);
$integer->decrement(1); // which is also the same as $integer->increment(-1);
if ($integer->getValue() == 0) {
// ...
}
if ($integer->exists()) {
// ...
$integer->delete();
}
$driver = // get a specific driver somehow, see further
$lock = \PhpSync\Generic\Lock::getInstance('some_lock', $driver);