polderknowledge/php-peek-lock

A PHP library which acts as a wrapper around flock() to provide an interprocess lock.

1.0.1 2017-07-07 12:14 UTC

This package is auto-updated.

Last update: 2024-04-12 03:13:59 UTC


README

Latest Version on Packagist Software License Build Status Coverage Status Quality Score Total Downloads

A PHP class which wraps flock()

You can use this to run jobs in the background and peek from the webserver if they are running.

Install

Via Composer

$ composer require polderknowledge/php-peek-lock

Usage

// 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');

Change log

Please see CHANGELOG for more information what has changed recently.

Testing

$ composer test

Contributing

Please see CONTRIBUTING and CONDUCT for details.

Security

If you discover any security related issues, please report them via HackerOne instead of using the issue tracker or e-mail.

Community

We have an IRC channel where you can find us every now and then. We're on the Freenode network in the channel #polderknowledge.

Credits

License

Please see LICENSE.md for the license of this application.