Download the PHP package fperdomo/php-agi without Composer

On this page you can find all versions of the php package fperdomo/php-agi. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package php-agi

PHPAGI

PHPAGI is a PHP library that simplifies building Asterisk AGI (Asterisk Gateway Interface), AMI (Asterisk Manager Interface), and FastAGI applications. This repository is a modernized fork of the original welltime/phpagi project and is updated to be compatible with PHP 8.3+ while maintaining a familiar API for easier migration.

Table of Contents

Features

Requirements

Why this fork?

The original welltime/phpagi project is now archived, and many deployments still rely on the classic API. This package modernizes PHPAGI for PHP 8.3+ while keeping a familiar developer experience to simplify migration.

Installation

Install the package via Composer (replace with your vendor if you publish under a different name):

Usage

Below are minimal examples to get started with AGI, FastAGI, and AMI usage.

AGI script

AGI scripts are executed by Asterisk from the dialplan. Place executable PHP scripts in the location Asterisk can call.

Example: simple AGI script

Make the script executable:

In extensions.conf:

More AGI Examples

See the examples/agi/ directory for more comprehensive examples:

Production quickstart (AGI)

1) Install:

2) Put scripts in Asterisk AGI directory (commonly /var/lib/asterisk/agi-bin/). 3) Make executable and ensure correct owner:

4) In your dialplan:

5) Debug:

FastAGI as a systemd service

Running FastAGI with systemd (recommended)

Create /etc/systemd/system/phpagi-fastagi.service:

Enable & start:

Dialplan:

AMI security notes

FastAGI

FastAGI runs as a server process and handles AGI commands over TCP. Run a FastAGI server and configure Asterisk to call it.

Example FastAGI dispatcher:

Configure Asterisk to use FastAGI in extensions.conf:

FastAGI Example

See examples/fastagi/server.php for a complete FastAGI server implementation with example handlers.

Asterisk Manager (AMI)

Use the AgiAsteriskManager class to connect to Asterisk's management interface to receive events or take actions programmatically.

Example:

Environment Variables:

For security, use environment variables for sensitive configuration:

More AMI Examples

See the examples/ami/ directory for more comprehensive examples:

Examples

The examples/ directory contains practical, ready-to-use examples demonstrating various PHPAGI features:

AGI Examples (examples/agi/)

Example Description
interactive-menu.php Interactive IVR menu system with DTMF input handling
call-recording.php Record caller messages and store metadata in Asterisk database
database-lookup.php Lookup caller information using Asterisk database (AstDB)
call-center-router.php Complete call center with VIP detection, queues, and statistics
verbose.php Simple verbose logging demonstration
hello.php Minimal low-level AGI implementation without using PHPAGI class

AMI Examples (examples/ami/)

Example Description
ping.php Simple AMI connection test using Ping action
originate-call.php Originate outbound calls programmatically with custom variables
monitor-events.php Real-time event monitoring with custom event handlers

FastAGI Examples (examples/fastagi/)

Example Description
server.php Complete FastAGI server implementation
handlers/your-script.php Example FastAGI handler script

Running the Examples

AGI Examples:

AMI Examples:

FastAGI Examples:

Directory layout

A suggested layout for this project:

Contributing

Contributions are welcome. Suggested workflow:

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature/fooBar
  3. Commit your changes
  4. Push to your fork
  5. Open a Pull Request

Testing & CI: Ensure compatibility with PHP 8.3+; GitHub Actions or similar CI is recommended.

License

This project is released under the GNU Lesser General Public License (LGPL-2.1+), consistent with the original PHPAGI license.


All versions of php-agi with dependencies

PHP Build Version
Package Version
Requires php Version >=8.4
ext-sockets Version *
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package fperdomo/php-agi contains the following files

Loading the files please wait ...