PHP code example of mingalevme / illuminate-lock

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/ */

    

mingalevme / illuminate-lock example snippets


'Lock' => Mingalevme\Illuminate\Lock\Facades\Lock::class,

php artisan vendor:publish --provider="Mingalevme\Illuminate\Lock\LaravelLockServiceProvider" --tag="config"



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";
}

/vendor/mingalevme/illuminate-lock/config/lock.php
/config/lock.php