2017 © Pedro Peláez
 

library event

A shrimp of an event library

image

caridea/event

A shrimp of an event library

  • Tuesday, January 2, 2018
  • by doublecompile
  • Repository
  • 1 Watchers
  • 0 Stars
  • 812 Installations
  • PHP
  • 3 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 9 Versions
  • 1 % Grown

The README.md

caridea-event

Caridea is a miniscule PHP application library. This shrimpy fellow is what you'd use when you just want some helping hands and not a full-blown framework., (*1)

, (*2)

This is its event library. It has interfaces for Publisher and Listener, and an abstract class for Event., (*3)

If you'd like a concrete implementation of Publisher, try caridea-container., (*4)

Packagist Build Status Scrutinizer Code Quality Code Coverage, (*5)

Installation

You can install this library using Composer:, (*6)

$ composer require caridea/event
  • The master branch (version 3.x) of this project requires PHP 7.1 and has no dependencies.
  • Version 2.x of this project requires PHP 7.0 and has no dependencies.
  • Version 1.x of this project requires PHP 5.5 and has no dependencies.

Compliance

Releases of this library will conform to Semantic Versioning., (*7)

Our code is intended to comply with PSR-1, PSR-2, and PSR-4. If you find any issues related to standards compliance, please send a pull request!, (*8)

Documentation

Examples

Just a few quick examples., (*9)

Let's say you have defined these classes, (*10)

namespace Acme\Foo;

class CustomEvent extends \Caridea\Event\Event
{
}

class CustomEventListener implements \Caridea\Event\Listener
{
    public function notify(\Caridea\Event\Event $event)
    {
        if ($event instanceof CustomEvent) {
            // do something here
        }
    }
}

A publisher can be invoked like this:, (*11)

// Here, we assume that $publisher implements a \Caridea\Event\Publisher and that
// We have somehow registered an \Acme\Foo\CustomEventListener with it.
$publisher->publish(new \Acme\Foo\CustomEvent());
// Our CustomEventListener has its ->notify method invoked.

There's a no-op implementation of Publisher available as \Caridea\Event\NullPublisher., (*12)

PublisherAware

For classes which need the event publisher, you can make use of the PublisherAware interface, and optionally the PublisherSetter trait., (*13)

class MyClass implements \Caridea\Event\PublisherAware
{
    use \Caridea\Event\PublisherSetter;

    public function __construct()
    {
        $this->setPublisher(new \Caridea\Event\NullPublisher());
    }
}

The Versions

02/01 2018

dev-master

9999999-dev http://github.com/libreworks/caridea-event

A shrimp of an event library

  Sources   Download

Apache-2.0

The Requires

  • php >=7.1.0

 

The Development Requires

events event listener observer

02/01 2018

3.0.0

3.0.0.0 http://github.com/libreworks/caridea-event

A shrimp of an event library

  Sources   Download

Apache-2.0

The Requires

  • php >=7.1.0

 

The Development Requires

events event listener observer

18/12 2016

2.1.x-dev

2.1.9999999.9999999-dev http://github.com/libreworks/caridea-event

A shrimp of an event library

  Sources   Download

Apache-2.0

The Requires

  • php >=7.0.0

 

The Development Requires

events event listener observer

19/09 2016

2.1.0

2.1.0.0 http://github.com/libreworks/caridea-event

A shrimp of an event library

  Sources   Download

Apache-2.0

The Requires

  • php >=7.0.0

 

The Development Requires

events event listener observer

22/03 2016

2.0.0

2.0.0.0 http://github.com/libreworks/caridea-event

A shrimp of an event library

  Sources   Download

Apache-2.0

The Requires

  • php >=7.0.0

 

The Development Requires

events event listener observer

22/03 2016

2.0.x-dev

2.0.9999999.9999999-dev http://github.com/libreworks/caridea-event

A shrimp of an event library

  Sources   Download

Apache-2.0

The Requires

  • php >=7.0.0

 

The Development Requires

events event listener observer

21/03 2016

1.x-dev

1.9999999.9999999.9999999-dev http://github.com/libreworks/caridea-event

A shrimp of an event library

  Sources   Download

Apache-2.0

The Requires

  • php >=5.5.0

 

The Development Requires

events event listener observer

21/03 2016

1.0.0

1.0.0.0 http://github.com/libreworks/caridea-event

A shrimp of an event library

  Sources   Download

Apache-2.0

The Requires

  • php >=5.5.0

 

The Development Requires

events event listener observer

03/06 2015

0.1.0

0.1.0.0 http://github.com/libreworks/caridea-event

A shrimp of an event library

  Sources   Download

Apache-2.0

The Requires

  • php >=5.5.0

 

events event listener observer