componenta/cqrs-lock

Resource lock middleware for Componenta CQRS commands

Maintainers

Package info

github.com/componenta/cqrs-lock

pkg:composer/componenta/cqrs-lock

Transparency log

Statistics

Installs: 12

Dependents: 0

Suggesters: 1

Stars: 0

Open Issues: 0

v2.0.0 2026-08-08 15:42 UTC

This package is auto-updated.

Last update: 2026-08-08 16:38:46 UTC


README

Resource lock middleware package for componenta/cqrs commands marked with #[Componenta\CQRS\Lock\Attribute\Lock].

composer require componenta/cqrs-lock

Register the provider and configure Symfony\Component\Lock\LockFactory in the container.

return [
    new Componenta\CQRS\ConfigProvider(),
    new Componenta\CQRS\Lock\ConfigProvider(),
];

The provider registers Componenta\CQRS\Lock\Attribute\Lock as a generic CQRS metadata attribute and provides Componenta\CQRS\Command\Middleware\ResourceLockMiddleware plus lock-related exceptions. With componenta/cqrs-app, the attribute is included in the versioned build map automatically; without it, the core metadata provider can reflect an unknown command at runtime.

Add ResourceLockMiddleware to ConfigKey::COMMAND_MIDDLEWARES where locking is required. The application must provide Symfony\Component\Lock\LockFactory.