PHPackages                             crazedsanity/lockfile - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. crazedsanity/lockfile

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

crazedsanity/lockfile
=====================

Create a \*.lock file, such as to lock down upgrades from running concurrently.

v0.1.3(9y ago)02031MITPHPPHP &gt;=5.3.0

Since May 15Pushed 8y ago1 watchersCompare

[ Source](https://github.com/crazedsanity/lockfile)[ Packagist](https://packagist.org/packages/crazedsanity/lockfile)[ Docs](http://www.crazedsanity.com)[ RSS](/packages/crazedsanity-lockfile/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (1)Versions (5)Used By (1)

Lock File
=========

[](#lock-file)

This class is intended to avoid having multiple instances of a certain process (like an upgrade, such as with cs\_webdbupgrade) from "tripping" over each other. Create a lock file somewhere on the system (which is readable + writable), and remove it when the operation completes. The file should stay if there's a problem that keeps the operation from completing (because trying again would probably fail, or would make things worse).

```
use crazedsanity\lockfile\LockFile;

$lock = new LockFile('/path/to/rw/dir', 'file.lock');

if(!$lock->is_lockfile_present()) {
	$lock->create_lockfile($upgradeWording);

	// ... do some stuff...
	// Only delete the lockfile if it all succeeded
	$lock->delete_lockfile();
}
else {
	throw new exception($lock->read_lockfile());
}
```

You may want to look at [Web DB Upgrade](https://github.com/crazedsanity/webdbupgrade) for an implementation example.

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity51

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~180 days

Total

4

Last Release

3479d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/2e5c258da2d3360da7bc80c01e0a97ff96a036cef58f8a5434daf469ad7cc186?d=identicon)[crazedsanity](/maintainers/crazedsanity)

---

Top Contributors

[![crazedsanity](https://avatars.githubusercontent.com/u/1490894?v=4)](https://github.com/crazedsanity "crazedsanity (10 commits)")

---

Tags

phpdryoaoo

### Embed Badge

![Health badge](/badges/crazedsanity-lockfile/health.svg)

```
[![Health](https://phpackages.com/badges/crazedsanity-lockfile/health.svg)](https://phpackages.com/packages/crazedsanity-lockfile)
```

###  Alternatives

[imanghafoori/laravel-anypass

A minimal yet powerful package to help you in development.

21421.6k](/packages/imanghafoori-laravel-anypass)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
