PHPackages                             rtckit/esl - 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. [HTTP &amp; Networking](/categories/http)
4. /
5. rtckit/esl

ActiveLibrary[HTTP &amp; Networking](/categories/http)

rtckit/esl
==========

FreeSWITCH Event Socket Layer (ESL) Library

0.8.0(4y ago)61.4k↓57.7%3MITPHPPHP &gt;=7.4.0

Since Jan 15Pushed 4y ago2 watchersCompare

[ Source](https://github.com/rtckit/php-esl)[ Packagist](https://packagist.org/packages/rtckit/esl)[ Docs](https://github.com/rtckit/php-esl)[ RSS](/packages/rtckit-esl/feed)WikiDiscussions main Synced yesterday

READMEChangelog (1)Dependencies (3)Versions (2)Used By (3)

FreeSWITCH Event Socket Layer library for PHP
=============================================

[](#freeswitch-event-socket-layer-library-for-php)

[![Build Status](https://camo.githubusercontent.com/30070bca3d46155b0585561a6f203e4a2557f80ddad74a557d1524144a47d1ac/68747470733a2f2f6170702e7472617669732d63692e636f6d2f7274636b69742f7068702d65736c2e7376673f6272616e63683d6d61696e)](https://app.travis-ci.com/rtckit/php-esl)[![Latest Stable Version](https://camo.githubusercontent.com/c8e8096e7c185f52f7ece3d6b35ef029d43b3b487daaba8134c9b256a2f0b4ff/68747470733a2f2f706f7365722e707567782e6f72672f7274636b69742f65736c2f762f737461626c652e706e67)](https://packagist.org/packages/rtckit/esl)[![Test Coverage](https://camo.githubusercontent.com/4e7836059a15b34eae971259dad805f2df7333cec055f8a045a52c97882a32da/68747470733a2f2f6170692e636f6465636c696d6174652e636f6d2f76312f6261646765732f61666635656538653865663362353136383963322f746573745f636f766572616765)](https://codeclimate.com/github/rtckit/php-esl/test_coverage)[![Maintainability](https://camo.githubusercontent.com/79003d1c55c8cbb4a78ac8922d4450bcd3ce128249784dbf0c662130c19487d2/68747470733a2f2f6170692e636f6465636c696d6174652e636f6d2f76312f6261646765732f61666635656538653865663362353136383963322f6d61696e7461696e6162696c697479)](https://codeclimate.com/github/rtckit/php-esl/maintainability)[![License](https://camo.githubusercontent.com/b8cadaa967891081f8f165695470689986c028821dd8a040132f6e661795dc0d/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c7565)](LICENSE)

Quickstart
----------

[](#quickstart)

[FreeSWITCH](https://github.com/signalwire/freeswitch)'s Event Socket Layer is a TCP control interface enabling the development of complex dynamic dialplans/workflows. You can learn more about its [inbound mode](https://freeswitch.org/confluence/display/FREESWITCH/mod_event_socket) as well as its [outbound mode](https://freeswitch.org/confluence/display/FREESWITCH/Event+Socket+Outbound) on the FreeSWITCH website.

This library provides an I/O agnostic implementation of the ESL protocol.

#### ESL Message Parsing

[](#esl-message-parsing)

The authentication stage of an ESL connection can be summarized as follows:

```
/* This is a typical FreeSWITCH ESL server greeting */
$response = \RTCKit\ESL\Response::Parse("Content-Type: auth/request\n\n");

echo 'A server sends: ' . get_class($response) . PHP_EOL;

/* Since we've been told to authenticate, let's prepare our auth request */
$request = \RTCKit\ESL\Request::parse("auth ClueCon\n\n");

echo 'A client responds with: ' . get_class($request) . '; ';
echo 'password: ' . $request->getParameters() . PHP_EOL;

/* If our secret is correct, the ESL server should confirm that */
$followup = \RTCKit\ESL\Response::parse("Content-Type: command/reply\nReply-Text: +OK accepted\n\n");

echo 'Then the server replies with: ' . get_class($followup) . '; ';
echo ($followup->isSuccessful() ? 'Success!' : 'Yikes!') . PHP_EOL;
```

#### ESL Message Rendering

[](#esl-message-rendering)

The reverse procedure, rendering to string, is straightforward:

```
$response = new \RTCKit\ESL\Response\AuthRequest;

echo 'A server sends: "' . $response->render() . '"' . PHP_EOL;

$request = new \RTCKit\ESL\Request\Auth;
$request->setParameters('ClueCon');

echo 'A client responds with: "' . $request->render() . '"' . PHP_EOL;

$followup = new \RTCKit\ESL\Response\CommandReply;
$followup->setHeader('reply-text', '+OK accepted');

echo 'Then the server replies with: "' . $followup->render() . '"' . PHP_EOL;
```

#### ESL Connection

[](#esl-connection)

Although this library is I/O independent, a Connection [interface](src/ConnectionInterface.php) and [base class](src/Connection.php) are being provided; since ESL runs over TCP, a stream oriented transport, it behooves to handle the message framing in a higher level library. An implementing project would simply invoke the `ConnectionInterface::consume()` method when input is available and would implement a `ConnectionInterface::emitBytes()` method which performs the corresponding I/O-specific write operations.

The Connection constructor requires a `$role` argument, which must be one of the following:

- `ConnectionInterface::INBOUND_CLIENT` to be used by ESL clients connecting to FreeSWITCH ESL servers;
- `ConnectionInterface::OUTBOUND_SERVER` to be used by ESL servers FreeSWITCH connects to in outbound mode;

The other two options are less common:

- `ConnectionInterface::INBOUND_SERVER` to impersonate a FreeSWITCH ESL server;
- `ConnectionInterface::OUTBOUND_CLIENT` to impersonate FreeSWITCH connecting to a remote ESL endpoint in outbound mode;

The latter two roles can be useful in test suites, implementing message relays, security research etc. Please note the inbound and outbound terms are relative to the FreeSWITCH endpoint (matching the [mod\_event\_socket](https://freeswitch.org/confluence/display/FREESWITCH/mod_event_socket) nomenclature).

Requirements
------------

[](#requirements)

**RTCKit\\ESL** is compatible with PHP 7.4+ and has no external library and extension dependencies.

Installation
------------

[](#installation)

You can add the library as project dependency using [Composer](https://getcomposer.org/):

```
composer require rtckit/esl
```

If you only need the library during development, for instance when used in your test suite, then you should add it as a development-only dependency:

```
composer require --dev rtckit/esl
```

Tests
-----

[](#tests)

To run the test suite, clone this repository and then install dependencies via Composer:

```
composer install
```

Then, go to the project root and run:

```
composer phpunit
```

### Static Analysis

[](#static-analysis)

In order to ensure high code quality, **RTCKit\\ESL** uses [PHPStan](https://github.com/phpstan/phpstan) and [Psalm](https://github.com/vimeo/psalm):

```
composer phpstan
composer psalm
```

License
-------

[](#license)

MIT, see [LICENSE file](LICENSE).

### Acknowledgments

[](#acknowledgments)

- [FreeSWITCH](https://github.com/signalwire/freeswitch), FreeSWITCH is a registered trademark of Anthony Minessale II

### Contributing

[](#contributing)

Bug reports (and small patches) can be submitted via the [issue tracker](https://github.com/rtckit/php-esl/issues). Forking the repository and submitting a Pull Request is preferred for substantial patches.

###  Health Score

26

—

LowBetter than 41% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity24

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity40

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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

Unknown

Total

1

Last Release

1630d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/d9f358b63c4304f3ad919493eba06c1566279c434fd69a5286abda691a05b92b?d=identicon)[cip](/maintainers/cip)

---

Top Contributors

[![cdosoftei](https://avatars.githubusercontent.com/u/7636091?v=4)](https://github.com/cdosoftei "cdosoftei (4 commits)")

---

Tags

event-socketfreeswitchfreeswitch-eslfreeswitch-event-sockettelephonytelephonyfreeswitchtelcoeslevent socket layer

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan, Psalm

Type Coverage Yes

### Embed Badge

![Health badge](/badges/rtckit-esl/health.svg)

```
[![Health](https://phpackages.com/badges/rtckit-esl/health.svg)](https://phpackages.com/packages/rtckit-esl)
```

###  Alternatives

[php-http/cache-plugin

PSR-6 Cache plugin for HTTPlug

25126.1M82](/packages/php-http-cache-plugin)[illuminate/http

The Illuminate Http package.

11937.9M6.9k](/packages/illuminate-http)[rdkafka/rdkafka

A PHP extension for Kafka

2.2k24.3k1](/packages/rdkafka-rdkafka)[httpsoft/http-message

Strict and fast implementation of PSR-7 and PSR-17

87965.9k114](/packages/httpsoft-http-message)[mezzio/mezzio-router

Router subcomponent for Mezzio

265.4M91](/packages/mezzio-mezzio-router)[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)
