Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: HEAD

This branch is 0 commits ahead and 10 commits behind master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

..
Octocat-spinner-32 library
Octocat-spinner-32 tests
Octocat-spinner-32 README
README
Phly_PubSub: Publish-Subscribe framework for PHP
================================================

Phly_PubSub is a simple, flexible Publish-Subscribe framework for PHP, 
based on Dojo's dojo.publish/dojo.subscribe system.

With Phly_PubSub, you may register any callback to listen on any topic, 
as well as publish notifications to any topic from any location. As an 
example:

    // Create logger and subscribe to 'log' topic
    $log = new \Zend_Log(new \Zend_Log_Writer_Stream('/tmp/app.log'));
    \phly\PubSub::subscribe('log', $log, 'info');

    // Within some application code:
    \phly\PubSub::publish('log', 'Log message');

Phly_PubSub can therefore be used: 

* to ensure a separation of concerns
* as a minimal Aspect-Oriented Programming (AOP) mechanism for PHP
* to provide an opt-in subject/observer mechanism for your code without
  requiring refactoring

TODO/Further Questions
======================
* Exception handling. Should exceptions raised by subscribers prevent 
  execution of other subscribers and/or the calling code?
  * If not, how should errors be handled/aggregated/reported?
Something went wrong with that request. Please try again.