PHPackages                             simple-as-fuck/laravel-lock - 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. simple-as-fuck/laravel-lock

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

simple-as-fuck/laravel-lock
===========================

Laravel integration for symfony/lock.

0.4.4(1mo ago)1128.3k↓28.2%1UnlicensePHPPHP ^8.2CI passing

Since Aug 29Pushed 1mo ago1 watchersCompare

[ Source](https://github.com/simple-as-fuck/laravel-lock)[ Packagist](https://packagist.org/packages/simple-as-fuck/laravel-lock)[ RSS](/packages/simple-as-fuck-laravel-lock/feed)WikiDiscussions 0.4 Synced 3d ago

READMEChangelog (10)Dependencies (30)Versions (40)Used By (0)

Simple as fuck / Laravel lock
=============================

[](#simple-as-fuck--laravel-lock)

Laravel integration for [symfony/lock](https://symfony.com/doc/current/components/lock.html).

Installation
------------

[](#installation)

```
composer require simple-as-fuck/laravel-lock
```

Support
-------

[](#support)

If any PHP platform requirements in [composer.json](../composer.json) ends with security support, consider package version as unsupported except last version.

[PHP supported versions](https://www.php.net/supported-versions.php).

Configuration
-------------

[](#configuration)

Add into your .env\_example and configure your environment on server.

```
LOCK_STORE=semaphore
LOCK_PREFIX=null
#LOCK_PGSQL_STORE_CONNECTION=null
```

Supported symfony lock store are only with native blocking lock, because it is fucking effective.

- `LOCK_STORE=semaphore` [SemaphoreStore](https://symfony.com/doc/current/components/lock.html#semaphorestore)recommended for simple production without application server replication (lock are stored in local ram)
- `LOCK_STORE=flock` [FlockStore](https://symfony.com/doc/current/components/lock.html#id3)recommended for local development, (lock are stored in local filesystem, so it should work everywhere)
- `LOCK_STORE=pgsql` [PostgreSqlStore](https://symfony.com/doc/current/components/lock.html#postgresqlstore)recommended for big production with application server replication (lock are stored remotely by postgres database), you can use special database for locks using setting laravel database connection name `LOCK_PGSQL_STORE_CONNECTION=some_postgre_sql_connection_name`, by default is used default database connection
- `LOCK_PREFIX=null`package will use `'app.name'` config value as lock keys prefix
- `LOCK_PREFIX=empty` or `LOCK_PREFIX=""`env sets prefix to empty string, simply turn off lock keys prefixing
- `LOCK_PREFIX="some_prefix"`env sets custom prefix and override prefix from application name

⚠ Changing lock configuration is [dangerous operation](https://symfony.com/doc/current/components/lock.html#overall). ⚠

If you need change lock store, you can use environment variables with `OLD_` prefix.

```
OLD_LOCK_STORE=semaphore
OLD_LOCK_PREFIX=null
#OLD_LOCK_PGSQL_STORE_CONNECTION=null
```

- For save configuration change copy your current lock configuration and prefix all environment keys with `OLD_` prefix, change basic environment variables with usage of new lock configuration.
- Keep your application running with both configurations for a while.
- After all processes with unchanged configuration ends or dies, remove all environment keys with `OLD_` prefix.

⚠ If your change of multiple environment variables is not atomic operation, you should change variables in specific order. First create variables with `OLD_` prefix, `OLD_LOCK_STORE` create as last one, second if you need, prepare specific variables for specific store, third if you need, change `LOCK_PREFIX` at last if you need, change `LOCK_STORE`. While you cleaning `OLD_` prefix, remove `OLD_LOCK_STORE` as first.

Is not recommended run application with old configuration for long time because locking with old store is less effective.

Usage
-----

[](#usage)

```
/**
 * @var \Illuminate\Contracts\Foundation\Application $app
 * @var \SimpleAsFuck\LaravelLock\Service\LockManager $lockManager
 */
$lockManager = $app->make(\SimpleAsFuck\LaravelLock\Service\LockManager::class);

$lock = $lockManager->acquire('some_lock_key');
try {
    //happy run some critical code synchronously
} finally {
    $lock->release();
}

$lock = $lockManager->acquireMultiple(['some_lock_key', 'second_lock_key']);
try {
    //happy run some critical code synchronously
} finally {
    $lock->release();
}
```

###  Health Score

55

—

FairBetter than 97% of packages

Maintenance91

Actively maintained with recent releases

Popularity35

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity66

Established project with proven stability

 Bus Factor1

Top contributor holds 98.7% 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 ~44 days

Recently: every ~21 days

Total

40

Last Release

42d ago

PHP version history (4 changes)0.1.0PHP ^7.4|^8.0

0.1.6PHP ^8.0

0.1.8PHP ^8.1

0.2.18PHP ^8.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/dcf2ca03f52f05685f62127eaeb513e84856c4cbbdc728fb0eb99d6e659a7a37?d=identicon)[Triplkrypl](/maintainers/Triplkrypl)

---

Top Contributors

[![Triplkrypl](https://avatars.githubusercontent.com/u/15320684?v=4)](https://github.com/Triplkrypl "Triplkrypl (74 commits)")[![ashceo](https://avatars.githubusercontent.com/u/49865434?v=4)](https://github.com/ashceo "ashceo (1 commits)")

---

Tags

laravellockphpsimple

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/simple-as-fuck-laravel-lock/health.svg)

```
[![Health](https://phpackages.com/badges/simple-as-fuck-laravel-lock/health.svg)](https://phpackages.com/packages/simple-as-fuck-laravel-lock)
```

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3355.3M346](/packages/psalm-plugin-laravel)[laravel/ai

The official AI SDK for Laravel.

1.0k3.2M203](/packages/laravel-ai)[illuminate/queue

The Illuminate Queue package.

21332.6M1.6k](/packages/illuminate-queue)[api-platform/laravel

API Platform support for Laravel

58171.8k14](/packages/api-platform-laravel)[pressbooks/pressbooks

Pressbooks is an open source book publishing tool built on a WordPress multisite platform. Pressbooks outputs books in multiple formats, including PDF, EPUB, web, and a variety of XML flavours, using a theming/templating system, driven by CSS.

45444.2k1](/packages/pressbooks-pressbooks)[flarum/core

Delightfully simple forum software.

201.4M2.3k](/packages/flarum-core)

PHPackages © 2026

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