Skip to content

permanaj/codeigniter-events

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 

Repository files navigation

Events

Version 1.0

Based off (unreleased) code by Eric Barnes (with his permission of course).

DESCRIPTION

Events is a simple events library for CodeIgniter (all versions)

INSTALLATION

1. Copy Events.php to your application/libraries folder.
2. Load it like normal: $this->load->library('events'); (or autoload it).

USAGE

All Events functions are static.

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

Events::register('event_name_here', array('class_name_or_object_ref', 'method_name'));

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

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

$event_return = Events::trigger('event_name_here', $data, 'string');

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

  • ‘array’
  • ‘json’
  • ‘serialized’
  • ‘string’ (the default)

About

A simple events library for CodeIgniter

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 100.0%