PHP code example of fostam / filelock

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

    

fostam / filelock example snippets




 new \Fostam\FileLock\FileLock('mylock');
if (!$fl->acquire()) {
    exit;
}

// do exclusive stuff

$fl->release();
`
$filename = $fl->getLockFileName();