benconstable/lock
最新稳定版本:v1.0.2
Composer 安装命令:
composer require benconstable/lock
包简介
Simple object-oriented file lock management
关键字:
README 文档
README
The standard PHP flock function is difficult to test against. This
library provides a modern, object-oriented wrapper to flock.
Installation
Add the following to your composer.json:
{
"require": {
"benconstable/lock": "~1.0"
}
}
Usage
<?php $lock = new BenConstable\Lock\Lock('/path/to/file.txt'); try { $lock->acquire(); // Lock successful... // Release lock. Optional, as resource will also be released automatically // when the lock object is destroyed $lock->release(); } catch (BenConstable\Lock\Exception\LockException $e) { // Lock failed... }
Development & contribution
To develop and/or contribute to this library, you must add tests for your code. Tests are built with Phpspec. To run them:
$ git clone https://github.com/BenConstable/lock && cd lock/ $ composer install $ bin/phpspec run
统计信息
- 总下载量: 1.13k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 7
- 点击次数: 2
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2014-11-16