dorantor/filelock

Simple php library providing OOP-interface to file locks.

v1.0.0 2017-10-24 13:25 UTC

This package is auto-updated.

Last update: 2024-05-29 03:49:10 UTC


README

Build Status Total Downloads Coverage Status Latest Stable Version License

Simple php library providing OOP-interface to file locks.

Installation

composer require dorantor/filelock

Usage

<?php
 
// create lock object
$lock = new \Dorantor\FileLock('path/to/file');

// ..and work with it
if ($lock->acquire()) {
    // file is locked
    $lock->release();
}
 
// ..or it could be
if (!$lock->acquire()) {
    // failed with lock
    return;
}
// file was locked
$lock->release();

Credits

Idea, interfaces and some code shamelessly taken from benconstable/lock.