1. Go to this page and download the library: Download redbitcz/utils 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/ */
redbitcz / utils example snippets
$locker = new Locker(__DIR__, 'example', Locker::NON_BLOCKING);
try {
$locker->lock();
// ... exclusive operation
$locker->unlock();
}
catch (LockObtainException $e) {
die('Error: Another process is alreasy processing that stuff');
}
$locker = new Locker(__DIR__, 'example', Locker::BLOCKING);
$locker->lock(); // concurrent process will be wait here to release previous lock
// ... exclusive operation
$locker->unlock();