PHP code example of phmlabs / annovent

1. Go to this page and download the library: Download phmlabs/annovent library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

phmlabs / annovent example snippets


$dispatcher = new Dispatcher();
$dispatcher->connect('SomeComponent.Render', array($listener, 'Method1'));
$dispatcher->notify(new Event('SomeComponent.Render', array('foo' => 'bar'));

$dispatcher->connect('SomeComponent.*', array($listener, 'Method1'));
$dispatcher->connect('*', array($listener, 'Method2'));


class Listener
{
  /**
   * @Event("SomeComponent.Render")
   */
  public function method1(Event $event)
  {
  }
}

$dispatcher->connectListener( new Listener );

class Listener2
{
  /**
   * @Event("SomeComponent.Render")
   */
  public function method1($argument1, $foo)
  {
  }
}
$dispatcher->notify(new Event('SomeComponent.Render', array('foo' => 'bar', 'argument1' => 'arg1' ));