1. Go to this page and download the library: Download adrian0350/php-ami 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/ */
adrian0350 / php-ami example snippets
// Configure as
'host' => '192.168.1.250',
'username' => 'root',
'password' => 'toor',
'port' => 5038,
'connect_timeout' => 10,
'read_timeout' => 100,
'scheme' => 'tcp://'
);
$AMIClient = new AMIClient($options);
$AMIListener = new AMIListener();
// Registering a closure ** NOT AVAILABLE FOR PHP VERSION 5.1.6 **
$AMIClient->registerEventListener(function($event){});
// Register a specific method of an object for event listening
$AMIClient->registerEventListener(array($AMIListener, 'handle'));
// Register an IEventListener:
$AMIClient->registerEventListener($AMIListener);