PHP code example of baraja-core / lock

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

    

baraja-core / lock example snippets


// start no-name transaction
Lock::startTransaction();

if (Lock::isTransactionRunning()) {
    // Transaction is running...
}

// Stop no-name transaction
Lock::stopTransaction();

Lock::wait('order-number');

// start transaction "order-number" for 5 seconds
Lock::startTransaction('order-number', 5000);

// run something special...

// stop transaction
Lock::stopTransaction('order-number');