brick/lock

Advisory locks library

Maintainers

Details

github.com/brick/lock

Source

Issues

Fund package maintenance!
BenMorel

dev-main 2025-08-12 02:12 UTC

This package is auto-updated.

Last update: 2025-08-12 17:03:31 UTC


README

A PHP library to work with advisory locks.

Build Status Coverage Status Latest Stable Version Total Downloads License

Installation

This library is installable via Composer:

composer require brick/lock

Requirements

This library requires PHP 8.2 or later.

Overview

To be written.

Use in a Symfony project

In a Symfony project using the Doctrine ORM, add the following config, typically in config/services.yaml:

services:
    Brick\Lock\LockFactoryInterface:
        class: Brick\Lock\LockFactory

    Brick\Lock\LockDriverInterface:
        # choose the driver that corresponds to your database:
        class: Brick\Lock\Driver\MysqlLockDriver
        # class: Brick\Lock\Driver\PostgresLockDriver

    Brick\Lock\Database\ConnectionInterface:
        # choose the connection you want to use; in a typical Symfony project
        # with the Doctrine ORM, you'll probably want to use DoctrineConnection:
        class: Brick\Lock\Database\Connection\DoctrineConnection
        # class: Brick\Lock\Database\Connection\PdoConnection

You can now type-hint the Brick\Lock\LockFactoryInterface service in your code and use it to create locks.