0

I am using the Phalcon micro application as my REST web service. I want to add an event to the application and fire this event from different places like controllers.
For example; if a user registers, the controller should fire a userRegistered event, and userRegistered should do some stuff.

How can I implement this?

interface IUsers
{
    function onUserRegistered();
}

Event class

class UsersActivities implements IUsers
{
    function onUserRegistered()
    {
        // TODO: Implement onUserRegistered() method.
    }
}
Timothy
  • 2,004
  • 3
  • 23
  • 29
Ali
  • 443
  • 5
  • 22

1 Answers1

0

Just check docs. It's pretty simple, create manager, creat listener(UsersActivities in your case i guess) and fire events in manager.

https://docs.phalconphp.com/pl/latest/reference/events.html

Juri
  • 1,369
  • 10
  • 16