1. Go to this page and download the library: Download mingalevme/illuminate-lock 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/ */
use Mingalevme\Illuminate\Lock\Facades\Lock;
$lock = Lock::createLock('resource-id');
if ($lock->acquire()) {
echo "Resource has been locked";
} else {
echo "Could not get lock";
}
use Mingalevme\Illuminate\Lock\Facades\Lock;
$lock = Lock::store('redis')->createLock('resource-id');
if ($lock->acquire()) {
echo "Resource has been locked";
} else {
echo "Could not get lock";
}