eleven-x/event

Event system

Installs: 19

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 0

Forks: 0

Open Issues: 0

pkg:composer/eleven-x/event

v0.1.0 2016-12-29 01:32 UTC

This package is not auto-updated.

Last update: 2025-10-12 02:01:05 UTC


README

Simple php event system

Install

composer require eleven-x/event

API

addListener($eventName, \Closure $listener, $priority = 0, $once = false)

Adds the listener function to the end of the listeners array for the event named $eventName

  • $eventName event name
  • $listener listener function
  • $priority The higher the value, the higher the priority
  • $once whether it is a one-time

once($eventName, \Closure $listener)

Adds a one time listener function for the event named $eventName. The next time $eventName is triggered, this listener is removed and then invoked.

  • $eventName event name
  • $listener listener function

removeListener($eventName)

Removes the specified listener from the listener array for the event named $eventName.

  • $eventName event name

hasListeners($eventName)

Whether there is a listener

  • $eventName event name

dispatch($eventName, Event $event = null)

Calls each of the listeners registered for the event named $eventName

  • $eventName event name
  • $event Event object

License

MIT