Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>For PHP I've regulary integrated the Symfony Event Component: <a href="http://components.symfony-project.org/event-dispatcher/" rel="noreferrer">http://components.symfony-project.org/event-dispatcher/</a>.</p> <p>Here's a short example below, which you can find expanded in Symfony's <a href="http://components.symfony-project.org/event-dispatcher/trunk/book/02-Recipes" rel="noreferrer">Recipe section</a>.</p> <pre><code>&lt;?php class Foo { protected $dispatcher = null; // Inject the dispatcher via the constructor public function __construct(sfEventDispatcher $dispatcher) { $this-&gt;dispatcher = $dispatcher; } public function sendEvent($foo, $bar) { // Send an event $event = new sfEvent($this, 'foo.eventName', array('foo' =&gt; $foo, 'bar' =&gt; $bar)); $this-&gt;dispatcher-&gt;notify($event); } } class Bar { public function addBarMethodToFoo(sfEvent $event) { // respond to event here. } } // Somewhere, wire up the Foo event to the Bar listener $dispatcher-&gt;connect('foo.eventName', array($bar, 'addBarMethodToFoo')); ?&gt; </code></pre> <p>This is the system we integrated into a shopping cart to create a game-like shopping experience, hooking user actions into game-events. When the user performed specific actions, php fired events causing rewards to be triggered. </p> <p>Example 1: if the user clicked a specific button 10 times, they received a star. </p> <p>Example 2: when the user refers a friend and that friend signs up an event is fired rewarding the original referrer with points.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload