1. Go to this page and download the library: Download tourze/lock-service-bundle 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/ */
tourze / lock-service-bundle example snippets
use Tourze\LockServiceBundle\Service\LockService;
$lockService = ... // Get via dependency injection
// Blocking execution
$lockService->blockingRun('resource-key', function () {
// Logic protected by lock
});
// Multi-resource locking
$lockService->blockingRun(['key1', 'key2'], function () {
// Logic protected by multiple locks
});