Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

added new event listeners to the example and readme

  • Loading branch information...
commit 23e5204c2650ea314b5bef177222acec77c8013f 1 parent 5ebf74f
@marcelog authored
Showing with 33 additions and 0 deletions.
  1. +25 −0 README
  2. +8 −0 docs/examples/quickstart/example.php
View
25 README
@@ -44,6 +44,31 @@ Asterisk versions supported
PAMI is tested in asterisk 1.6 versions, just because this is the version
I use in my boxes. If you need support for other versions, please contact me.
--------------------------------------------------------------------------------
+QuickStart
+==========
+$options = array(
+ 'log4php.properties' => RESOURCES_DIR . DIRECTORY_SEPARATOR . 'log4php.properties',
+ 'host' => '2.3.4.5',
+ 'scheme' => 'tcp://',
+ 'port' => 9999,
+ 'username' => 'asd',
+ 'secret' => 'asd',
+ 'connect_timeout' => 10,
+ 'read_timeout' => 10
+);
+$client = new \PAMI\Client\Impl\ClientImpl($options);
+
+// Registering a closure
+$client->registerEventListener(function ($event) {
+});
+
+// Register a specific method of an object for event listening
+$client->registerEventListener(array($listener, 'handle'));
+
+// Register an IEventListener:
+$client->registerEventListener($listener);
+
+--------------------------------------------------------------------------------
Example
=======
Please see docs/examples/quickstart/example.php for a very basic example.
View
8 docs/examples/quickstart/example.php
@@ -159,6 +159,14 @@ public function handle(EventMessage $event)
'scheme' => 'tcp://' // try tls://
);
$a = new ClientImpl($options);
+ // Registering a closure
+ //$client->registerEventListener(function ($event) {
+ //});
+
+ // Register a specific method of an object for event listening
+ //$client->registerEventListener(array($listener, 'handle'));
+
+ // Register an IEventListener:
$a->registerEventListener(new A());
$a->open();
/*
Please sign in to comment.
Something went wrong with that request. Please try again.