Get support for ericlbarnes/CodeIgniter-Events

If you're new to LTH, please see our FAQ for more information on what it is we do.

Support Options

Unfortunately, there are currently no active helpers for this repository on the platform. Until they become available, we reccomend the following actions:

View Open Issues

Take a look to see if anyone else has experienced the same issue as you and if they managed to solve it.

Open an Issue

Make sure to read any relevant guidelines for opening issues on this repo before posting a new issue.

Sponsor directly

Check out the page and see if there are any options to sponsor this project or it's developers directly.

ericlbarnes/CodeIgniter-Events

No longer maintained

I am not longer going to maintain this project. Please visit this fork to get one that is maintained:

https://github.com/nathanmac/CodeIgniter-Events


CodeIgniter Events Library

Build extendible applications with an events system.

Version 1.0.0

Public Methods

register

Registers a Callback for a given event

  • $event string
  • $callback array
  • Example: Events::register('test_string', array('Class_name', 'string_return'));

trigger

Triggers an event and returns the results.

  • $event string - The name of the event
  • $data mixed - Any data that is to be passed to the listener
  • $return_type string - Either 'array', 'json', 'serialized', or 'string'
  • Example: Events::trigger('test_string', 'test', 'string');

has_listeners

Checks if the event has any listeners

  • $event string - The name of the event
  • return bool

Usage Overview

All Events functions are static.

You can add a listener to an event with the register() function:

The second parameter of register() is an array that is callable via call_user_func().

You trigger an Event by calling the trigger() function:

The 3rd parameter is the type of data you wish trigger() to return. Your options are as follows:

  • 'array'
  • 'json'
  • 'serialized'
  • 'string' (the default)

Example Usage

Because events need to be registered before being used it is a good idea to have a system in place to load any of these before you trigger any events.

Here is an example using a third party library to register the event.

Our Mission

We want to make open source more sustainable. The entire platform was born from this and everything we do is in aid of this.

Interesting Articles

Thank you for checking out LiveTechHelper |
2025 © lth-dev incorporated

p-e622a1a2