PHPackages                             kstych/php-ami - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. kstych/php-ami

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

kstych/php-ami
==============

Asterisk Manager Interface (AMI) client for PHP, event driven, object oriented

v1.0.2(1mo ago)132Apache-2.0PHPPHP &gt;=5.3.3

Since Jan 1Pushed 1mo agoCompare

[ Source](https://github.com/kstych/php-ami)[ Packagist](https://packagist.org/packages/kstych/php-ami)[ Docs](http://kstych.com/PAMI)[ RSS](/packages/kstych-php-ami/feed)WikiDiscussions main Synced today

READMEChangelog (3)Dependencies (24)Versions (4)Used By (0)

Introduction
============

[](#introduction)

PAMI means PHP Asterisk Manager Interface. As its name suggests its just a set of php classes that will let you issue commands to an ami and/or receive events, using an observer-listener pattern.

The idea behind this, is to easily implement operator consoles, monitors, etc. either via SOA or ajax.

Installing
==========

[](#installing)

Add this library to your [Composer](https://packagist.org/) configuration. In composer.json:

```
  "require": {
    "kstych/php-ami": "*"
  }
```

QuickStart
==========

[](#quickstart)

```
// Make sure you include the composer autoload.
require __DIR__ . '/vendor/autoload.php';

$options = array(
    '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);
```

Using Predicates
================

[](#using-predicates)

A second (optional) argument can be used when registering the event listener: a closure that will be evaluated before calling the callback. The callback will be called only if this predicate returns true:

```
use PAMI\Message\Event\DialEvent;

$client->registerEventListener(
    array($listener, 'handleDialStart'),
    function ($event) {
        return $event instanceof DialEvent && $event->getSubEvent() == 'Begin';
    })
);
```

Example
=======

[](#example)

Please see docs/examples/quickstart/example.php for a very basic example.

For an example of using asynchronous AGI with PAMI, see docs/examples/asyncagi

Currently Supported Events
==========================

[](#currently-supported-events)

More events will be added with time. I can only add the ones I can test for and use, so your contributions may make the difference! ;)

Unknown (not yet implemented) events will be reported as UnknownEvent, so you can still catch them. If you catch one of these, please report it!

- AgentsComplete
- AgentConnect
- Agentlogin
- Agentlogoff
- AGIExec
- AsyncAGI
- Bridge
- BridgeInfoChannel
- BridgeInfoComplete
- CEL
- ChannelUpdate
- ConfbridgeEnd
- ConfbridgeJoin
- ConfbridgeLeave
- ConfbridgeList
- ConfbridgeListComplete
- ConfbridgeMute
- ConfbridgeStart
- ConfbridgeTalking
- ConfbridgeUnmute
- CoreShowChannel
- CoreShowChannelComplete
- DAHDIShowChannel
- DAHDIShowChannelsComplete
- FullyBooted
- DongleSMSStatus
- DongleUSSDStatus
- DongleNewUSSD
- DongleNewUSSDBase64
- DongleNewCUSD
- DongleStatus
- DongleDeviceEntry
- DongleShowDevicesComplete
- DBGetResponse
- Dial
- DTMF
- Extension
- Hangup
- Hold
- JabberEvent
- Join
- Leave
- Link
- ListDialplan
- Masquerade
- MessageWaiting
- MusicOnHold
- NewAccountCode
- NewCallerid
- Newchannel
- Newexten
- Newstate
- OriginateResponse
- ParkedCall
- ParkedCallsComplete
- PeerEntry
- PeerlistComplete
- PeerStatus
- QueueMember
- QueueMemberAdded
- QueueMemberRemoved
- QueueMemberPause
- QueueMemberStatus
- QueueParams
- QueueStatusComplete
- QueueSummaryComplete
- RegistrationsComplete
- Registry
- Rename
- RTCPReceived
- RTCPReceiver
- RTCPSent
- RTPReceiverStat
- RTPSenderStat
- ShowDialPlanComplete
- Status
- StatusComplete
- Transfer
- Unlink
- UnParkedCall
- UserEvent
- VarSet
- vgsm\_me\_state
- vgsm\_net\_state
- vgsm\_sms\_rx
- VoicemailUserEntry
- VoicemailUserEntryComplete

Currently Supported Actions
===========================

[](#currently-supported-actions)

- AbsoluteTimeout
- AGI
- Agents
- AgentLogoff
- Atxfer (asterisk 1.8?)
- Bridge
- BridgeInfo
- ChangeMonitor
- Command
- ConfbridgeList
- ConfbridgeMute
- ConfbridgeUnmute
- CoreSettings
- CoreShowChannels
- CoreStatus
- DAHDIDialOffHookAction
- DAHDIHangup
- DAHDIRestart
- DAHDIShowChannels
- DAHDIDNDOn
- DAHDIDNDOff
- DBGet
- DBPut
- DBDel
- DBDelTree
- DongleSendSMS
- DongleSendUSSD
- DongleSendPDU
- DongleReload
- DongleStop
- DongleStart
- DongleRestart
- DongleReset
- DongleShowDevices
- ExtensionState
- CreateConfig
- GetConfig
- GetConfigJSON
- GetVar
- Hangup
- JabberSend
- LocalOptimizeAway
- Login
- Logoff
- ListCategories
- ListCommands
- MailboxCount
- MailboxStatus
- MeetmeList
- MeetmeMute
- MeetmeUnmute
- MixMonitor
- ModuleCheck
- ModuleLoad (split in ModuleLoad, ModuleUnload, and ModuleReload)
- Monitor
- Originate
- ParkedCalls
- PauseMonitor
- Ping
- PlayDTMF
- Queues
- QueueAdd
- Queue
- QueueLog
- QueuePause
- QueuePenalty
- QueueReload
- QueueRemove
- QueueReset
- QueueRule
- QueueSummary
- QueueStatus
- QueueUnpause
- Redirect
- Reload
- SendText
- SetVar
- ShowDialPlan
- Sipnotify
- Sippeers
- Sipqualifypeer
- Sipshowpeer
- Sipshowregistry
- Status
- StopMixMonitor
- StopMonitor
- UnpauseMonitor
- VGSM\_SMS\_TX
- VoicemailUsersList

Debugging, logging
------------------

[](#debugging-logging)

You can optionally set a [PSR-3](http://www.php-fig.org/psr/psr-3/) compatible logger:

```
$pami->setLogger($logger);
```

By default, the client will use the [NullLogger](http://www.php-fig.org/psr/psr-3/#1-4-helper-classes-and-interfaces).

Developers
==========

[](#developers)

This project uses [phing](https://www.phing.info/). Current tasks include:

- test: Runs [PHPUnit](https://phpunit.de/).
- cs: Runs [CodeSniffer](https://github.com/squizlabs/PHP_CodeSniffer).
- doc: Runs [PhpDocumentor](http://www.phpdoc.org/).
- md: runs [PHPMD](http://phpmd.org/).
- build: This is the default task, and will run all the other tasks.

Running a phing task
--------------------

[](#running-a-phing-task)

To run a task, just do:

```
vendor/bin/phing build
```

LICENSE
=======

[](#license)

Copyright 2026 Siddharth Upmanyu Copyright 2016 Marcelo Gornstein

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

```
http://www.apache.org/licenses/LICENSE-2.0

```

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

###  Health Score

38

—

LowBetter than 83% of packages

Maintenance92

Actively maintained with recent releases

Popularity9

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity32

Early-stage or recently created project

 Bus Factor1

Top contributor holds 84.5% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~72 days

Total

3

Last Release

38d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/600f79652d9fa767a0dffc1de7ffef5718a29c45c9de4580eb74308f597684a6?d=identicon)[kstych](/maintainers/kstych)

---

Top Contributors

[![marcelog](https://avatars.githubusercontent.com/u/527356?v=4)](https://github.com/marcelog "marcelog (332 commits)")[![thomasvargiu](https://avatars.githubusercontent.com/u/732012?v=4)](https://github.com/thomasvargiu "thomasvargiu (22 commits)")[![shinomontaz](https://avatars.githubusercontent.com/u/9953247?v=4)](https://github.com/shinomontaz "shinomontaz (6 commits)")[![drakhar-mike](https://avatars.githubusercontent.com/u/3764278?v=4)](https://github.com/drakhar-mike "drakhar-mike (6 commits)")[![mstyles](https://avatars.githubusercontent.com/u/1187931?v=4)](https://github.com/mstyles "mstyles (5 commits)")[![cch99](https://avatars.githubusercontent.com/u/2806775?v=4)](https://github.com/cch99 "cch99 (5 commits)")[![jacobkiers](https://avatars.githubusercontent.com/u/402504?v=4)](https://github.com/jacobkiers "jacobkiers (4 commits)")[![AlmogBaku](https://avatars.githubusercontent.com/u/98982?v=4)](https://github.com/AlmogBaku "AlmogBaku (3 commits)")[![kstych](https://avatars.githubusercontent.com/u/4062349?v=4)](https://github.com/kstych "kstych (3 commits)")[![StrikeForceZero](https://avatars.githubusercontent.com/u/983413?v=4)](https://github.com/StrikeForceZero "StrikeForceZero (2 commits)")[![wormling](https://avatars.githubusercontent.com/u/1608160?v=4)](https://github.com/wormling "wormling (1 commits)")[![pkirk](https://avatars.githubusercontent.com/u/417485?v=4)](https://github.com/pkirk "pkirk (1 commits)")[![Quosimadu](https://avatars.githubusercontent.com/u/10835161?v=4)](https://github.com/Quosimadu "Quosimadu (1 commits)")[![richardfullmer](https://avatars.githubusercontent.com/u/384602?v=4)](https://github.com/richardfullmer "richardfullmer (1 commits)")[![tomcastleman](https://avatars.githubusercontent.com/u/1532660?v=4)](https://github.com/tomcastleman "tomcastleman (1 commits)")

---

Tags

eventclientmanagermonitorasteriskamiactionvoiptelephony

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/kstych-php-ami/health.svg)

```
[![Health](https://phpackages.com/badges/kstych-php-ami/health.svg)](https://phpackages.com/packages/kstych-php-ami)
```

###  Alternatives

[marcelog/pami

Asterisk Manager Interface (AMI) client for PHP, event driven, object oriented

418773.0k1](/packages/marcelog-pami)[chan-sccp/pami

Asterisk Manager Interface (AMI) client for PHP, event driven, object oriented (Fork)

2954.7k](/packages/chan-sccp-pami)[grumpydictator/firefly-iii

Firefly III: a personal finances manager.

23.9k69.5k](/packages/grumpydictator-firefly-iii)[marcelog/pagi

Asterisk Gateway Interface (AGI) client for PHP, suitable to make telephony applications using call flow nodes

190137.8k20](/packages/marcelog-pagi)[wormling/phparia

Asterisk REST Interface (ARI) client for PHP.

419.8k](/packages/wormling-phparia)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
