PHP code example of polderknowledge / php-peek-lock

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

    

polderknowledge / php-peek-lock example snippets


// lock the file in a job to prevent race conditions between jobs:
$lock = new PeekLock('mylockfile.txt');
$lock->blockTillLock();

// check if the job is running from the webpage
$lock = new PeekLock('mylockfile.txt');
echo 'busy? ' . ($lock->isLocked() ? 'yes' : 'no');
 bash
$ composer