PHPackages                             rtckit/react-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. [Queues &amp; Workers](/categories/queues)
4. /
5. rtckit/react-esl

ActiveLibrary[Queues &amp; Workers](/categories/queues)

rtckit/react-esl
================

Asynchronous FreeSWITCH Event Socket Layer (ESL) Library

0.8.6(4y ago)108651MITPHPPHP &gt;=7.4.0

Since Jan 20Pushed 4y ago1 watchersCompare

[ Source](https://github.com/rtckit/reactphp-esl)[ Packagist](https://packagist.org/packages/rtckit/react-esl)[ Docs](https://github.com/rtckit/reactphp-esl)[ RSS](/packages/rtckit-react-esl/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (3)Dependencies (8)Versions (4)Used By (1)

Asynchronous Event Socket Layer library for PHP
===============================================

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

[![Build Status](https://camo.githubusercontent.com/82d9da8e459575361f77e42102608417d1ac4177c22ad82530d0785847d91324/68747470733a2f2f6170702e7472617669732d63692e636f6d2f7274636b69742f72656163747068702d65736c2e7376673f6272616e63683d6d61696e)](https://app.travis-ci.com/rtckit/reactphp-esl)[![Latest Stable Version](https://camo.githubusercontent.com/bc9a74a01ebe6b2c7007531cc25e28632d7a5f73e554f00772d343d8a109bd56/68747470733a2f2f706f7365722e707567782e6f72672f7274636b69742f72656163742d65736c2f762f737461626c652e706e67)](https://packagist.org/packages/rtckit/react-esl)[![Test Coverage](https://camo.githubusercontent.com/4e7836059a15b34eae971259dad805f2df7333cec055f8a045a52c97882a32da/68747470733a2f2f6170692e636f6465636c696d6174652e636f6d2f76312f6261646765732f61666635656538653865663362353136383963322f746573745f636f766572616765)](https://codeclimate.com/github/rtckit/reactphp-esl/test_coverage)[![Maintainability](https://camo.githubusercontent.com/79003d1c55c8cbb4a78ac8922d4450bcd3ce128249784dbf0c662130c19487d2/68747470733a2f2f6170692e636f6465636c696d6174652e636f6d2f76312f6261646765732f61666635656538653865663362353136383963322f6d61696e7461696e6162696c697479)](https://codeclimate.com/github/rtckit/reactphp-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 builds on top of [ReactPHP](https://reactphp.org/) and [RTCKit\\ESL](https://github.com/rtckit/php-esl) and provides classes for four ESL elements: InboundClient and OutboundServer as well as InboundServer and OutboundClient. The former pair is more common and interfaces with FreeSWITCH for building RTC applications. The latter pair can be used to impersonate FreeSWITCH, for example in test suites, implementing message relays, security research etc. The directional terms (inbound/outbound) are relative to FreeSWITCH.

```

                         Inbound               Outbound

                 ┌──────────────────────┬─────────────────────┐
                 │                      │                     │
     Application │ InboundClient.php    │ OutboundServer.php  │
                 │                      │                     │
                 ├──────────────────────┼─────────────────────┤
                 │                      │                     │
     FreeSWITCH  │ InboundServer.php    │ OutboundClient.php  │
                 │                      │                     │
                 └──────────────────────┴─────────────────────┘

```

### Inbound Client Example

[](#inbound-client-example)

This usage mode refers to FreeSWITCH's inbound mode (usually listening on TCP 8021) and our application acts as the client. Typical interactions include issuing various requests and standing by for incoming events.

```
/* Instantiate the object */
$client = new \RTCKit\React\ESL\InboundClient('127.0.0.1', 8021, 'ClueCon');
$client
    ->connect() /* Initiate the connection; the library handles the authentication process */
    ->then(function (\RTCKit\React\ESL\InboundClient $client) {
        /* At this point our connection is established and authenticated; we can fire up any requests */
        $request = new \RTCKit\ESL\Request\Api;
        $request->setParameters('switchname');

        return $client->api($request);
    })
    ->then(function (\RTCKit\ESL\Response $response) use ($client, $stdio) {
        $switchname = trim($response->getBody());

        echo 'Connected to ' . $switchname . PHP_EOL;

        /* Issue more requests here! */
    })
    ->otherwise(function (Throwable $t) {
        echo 'Something went wrong: ' . $t->getMessage() . PHP_EOL;
    });
```

### Outbound Server Example

[](#outbound-server-example)

In this mode, FreeSWITCH (acting as the client) connects to our application (usually listening on TCP 8084) when a dialplan invokes the `socket` application.

```
/* Instantiate the object */
$server = new \RTCKit\React\ESL\OutboundServer('127.0.0.1', 8084);
/* Configure the handler */
$server->on('connect', function (\RTCKit\React\ESL\RemoteOutboundClient $client, \RTCKit\ESL\Response\CommandReply $response) {
    /* The library already sent the `connect` request at our behalf.
     * $response holds initial response. */
    $vars = $response->getHeaders();
    echo 'Outbound connection from ' . $vars['core-uuid'] . PHP_EOL;
    echo 'Call UUID ' . $vars['channel-unique-id'] . PHP_EOL;

    /* Issue requests */
    $client->resume();
    $client->linger();
    $client->myEvents('json');
    $client->divertEvents('on');

    /* Listen to events */
    $client->on('event', function (\RTCKit\ESL\Response\TextEventJson $response): void {
        /* Consume the event here! */
    });

    /* Add your business logic here */
    /* ... */

    /* Disconnect client */
    $client->close();
});
```

Lastly, the provided [examples](examples) are a good starting point.

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

[](#requirements)

**RTCKit\\React\\ESL** is compatible with PHP 7.4+.

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

[](#installation)

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

```
composer require rtckit/react-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/react-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\\React\\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/reactphp-esl/issues). Forking the repository and submitting a Pull Request is preferred for substantial patches.

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity23

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity41

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

Every ~35 days

Total

3

Last Release

1509d 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 (11 commits)")

---

Tags

freeswitchfreeswitch-eslfreeswitch-event-socketreactphptelephonyasyncreactphptelephonyfreeswitchtelcoeslevent socket layer

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan, Psalm

Type Coverage Yes

### Embed Badge

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

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

###  Alternatives

[react/socket

Async, streaming plaintext TCP/IP and secure TLS socket server and client connections for ReactPHP

1.3k116.9M402](/packages/react-socket)[react/dns

Async DNS resolver for ReactPHP

536114.1M100](/packages/react-dns)[react/promise-timer

A trivial implementation of timeouts for Promises, built on top of ReactPHP.

34141.9M96](/packages/react-promise-timer)[react/async

Async utilities and fibers for ReactPHP

2228.8M171](/packages/react-async)[clue/socks-react

Async SOCKS proxy connector client and server implementation, tunnel any TCP/IP-based protocol through a SOCKS5 or SOCKS4(a) proxy server, built on top of ReactPHP.

1171.1M33](/packages/clue-socks-react)[clue/docker-react

Async, event-driven access to the Docker Engine API, built on top of ReactPHP.

113154.9k1](/packages/clue-docker-react)

PHPackages © 2026

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