PHP code example of yriveiro / php-fslock

1. Go to this page and download the library: Download yriveiro/php-fslock 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/ */

    

yriveiro / php-fslock example snippets



use FSLock\FSLock;

$lock = new FSLock('test');

if ($lock->acquire()) {
    // Critical code.

    $lock->release();
}

$lock = new FSLock('test', '/tmp/');
sh
composer 
sh
php vendor/bin/phpunit tests