nona-creative/pid-manager

PID manager to lock php file execution

v0.1.3 2015-12-17 06:37 UTC

This package is not auto-updated.

Last update: 2024-05-24 14:44:13 UTC


README

PID manager to lock php file execution.

Installation

Install the latest version

composer require nona-creative/pid-manager

Basic Usage

<?php

$pidManager = new \Nona\PidManager('test.lock', './');

$pidManager->withLock(function() {
    // Do your processing here
    // ...
});
<?php

$pidManager = new \Nona\PidManager('test.lock', './');

if (!$pidManager->isLocked()) {
    try {
        $pidManager->lock();

        // Do your processing here
        // ...
    } finally {
        $pidManager->unlock();
    }
}