bentools/stoppable-event-trait

PSR-14 Stoppable Event implementation, shipped as a trait.

Fund package maintenance!
bpolaszek

Installs: 19

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 2

Forks: 0

Open Issues: 0

pkg:composer/bentools/stoppable-event-trait

1.0 2023-01-13 16:40 UTC

This package is auto-updated.

Last update: 2025-09-13 22:31:47 UTC


README

Latest Version on Packagist Total Downloads Tests Coverage

This is just a trait implementation of PSR-14's StoppableEventInterface.

Usage

use Bentools\StoppableEventTrait\StoppableEventTrait;
use Psr\EventDispatcher\StoppableEventInterface;

final class StoppableEvent implements StoppableEventInterface
{
    use StoppableEventTrait;
}

Any listener can call $event->stopPropagation() on your event, preventing further propagation of the event, regardless of the PSR-14 implementation you're using (as soon as they properly handle StoppableEventInterface events)

Installation

You can install the package via composer:

composer require bentools/stoppable-event-trait

Testing

composer test

License

The MIT License (MIT). Please see License File for more information.