2017 © Pedro Peláez
 

library event-manager

Simple Event Manager

image

koine/event-manager

Simple Event Manager

  • Thursday, February 18, 2016
  • by mjacobus
  • Repository
  • 1 Watchers
  • 0 Stars
  • 7 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 4 Versions
  • 0 % Grown

The README.md

Koine Event Manager

Simple Event Manager Code information:, (*1)

Build Status Coverage Status Code Coverage Scrutinizer Code Climate Scrutinizer Code Quality StyleCI, (*2)

Package information:, (*3)

Latest Stable Version Total Downloads Latest Unstable Version License Dependency Status, (*4)

Usage

<?php

use Koine\EventManager\EventManager;

$eventManager = EventManager();

$eventManager->attach('MyApp\DomainEvents\UserRegistered', function ($event) {
    $user = $event->getUser();

    // send welcome email to user
});

The event, (*5)

<?php

namespace MyApp\DomainEvents;

use MyApp\Entity\User;

class UserRegistered implements EventInterface
{
    private $user;

    public function __construct(User $user)
    {
        $this->user = $user;
    }

    public function getUser()
    {
        return $this->user;
    }
}

In the controller, service or anywhere else, (*6)

<?php

namespace MyApp\Controller;

use MyApp\DomainEvents\UserRegistered;
use MyApp\Entity\User;

class UserRegistration extends BaseController
{
    public function createAction()
    {
        $params = $this->getRequest()->getParams();

        $user = new User($params);

        // logic to create ommited

        $this->getEventManager()->trigger(new UserRegistered($user));

        // redirect or wathever
    }
}

Installing

Installing Via Composer

Append the lib to your requirements key in your composer.json., (*7)

{
    // composer.json
    // [..]
    require: {
        // append this line to your requirements
        "koine/event-manager": "*"
    }
}

Alternative install

Issues/Features proposals

Here is the issue tracker., (*8)

Lincense

MIT, (*9)

Authors

The Versions

18/02 2016

dev-master

9999999-dev

Simple Event Manager

  Sources   Download

MIT

The Requires

  • php >=5.4

 

The Development Requires

by Marcelo Jacobus

18/02 2016

dev-analysis-XkalPJ

dev-analysis-XkalPJ

Simple Event Manager

  Sources   Download

MIT

The Requires

  • php >=5.4

 

The Development Requires

by Marcelo Jacobus

18/02 2016

dev-analysis-XNAp5G

dev-analysis-XNAp5G

Simple Event Manager

  Sources   Download

MIT

The Requires

  • php >=5.4

 

The Development Requires

by Marcelo Jacobus

18/02 2016

1.0

1.0.0.0

Simple Event Manager

  Sources   Download

MIT

The Requires

  • php >=5.4

 

The Development Requires

by Marcelo Jacobus