An open API service indexing awesome lists of open source software.

https://github.com/brick/lock


https://github.com/brick/lock

Last synced: 11 months ago
JSON representation

Awesome Lists containing this project

README

          

## Brick\Lock

A PHP library to work with advisory locks.

[![Build Status](https://github.com/brick/lock/workflows/CI/badge.svg)](https://github.com/brick/lock/actions)
[![Coverage Status](https://coveralls.io/repos/github/brick/lock/badge.svg?branch=master)](https://coveralls.io/github/brick/lock?branch=master)
[![Latest Stable Version](https://poser.pugx.org/brick/lock/v/stable)](https://packagist.org/packages/brick/lock)
[![Total Downloads](https://poser.pugx.org/brick/lock/downloads)](https://packagist.org/packages/brick/lock)
[![License](https://img.shields.io/badge/license-MIT-blue.svg)](http://opensource.org/licenses/MIT)

### Installation

This library is installable via [Composer](https://getcomposer.org/):

```bash
composer require brick/lock
```

### Requirements

This library requires PHP 8.2 or later.

### Project status & release process

While this library is still under development, it is well tested and considered stable enough to use in production
environments.

The current releases are numbered `0.x.y`. When a non-breaking change is introduced (adding new methods, optimizing
existing code, etc.), `y` is incremented.

**When a breaking change is introduced, a new `0.x` version cycle is always started.**

It is therefore safe to lock your project to a given release cycle, such as `^0.13`.

If you need to upgrade to a newer release cycle, check the [release history](https://github.com/brick/lock/releases)
for a list of changes introduced by each further `0.x.0` version.

### 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`:

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

Brick\Lock\LockDriverInterface:
class: Brick\Lock\Driver\MysqlLockDriver

Brick\Lock\Database\ConnectionInterface:
class: Brick\Lock\Database\Connection\DoctrineConnection
```

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