PHPackages                             spiral/roadrunner-tcp - 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. spiral/roadrunner-tcp

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

spiral/roadrunner-tcp
=====================

RoadRunner: TCP worker

v4.1.1(11mo ago)91.6M↓35.1%11MITPHPPHP &gt;=8.1CI passing

Since Nov 1Pushed 11mo ago4 watchersCompare

[ Source](https://github.com/roadrunner-php/tcp)[ Packagist](https://packagist.org/packages/spiral/roadrunner-tcp)[ Docs](https://roadrunner.dev/)[ GitHub Sponsors](https://github.com/sponsors/roadrunner-server)[ RSS](/packages/spiral-roadrunner-tcp/feed)WikiDiscussions 4.x Synced 1mo ago

READMEChangelog (7)Dependencies (5)Versions (10)Used By (1)

[   ![](https://github.com/roadrunner-server/.github/assets/8040338/040fb694-1dd3-4865-9d29-8e0748c2c8b8) ](https://roadrunner.dev)RoadRunner TCP Plugin
=====================

[](#roadrunner-tcp-plugin)

[![PHP Version Require](https://camo.githubusercontent.com/69107d3514010ddee6b96f4336d70e626923d9bc4a8f6a907e3c5baaadc084a3/68747470733a2f2f706f7365722e707567782e6f72672f73706972616c2f726f616472756e6e65722d7463702f726571756972652f706870)](https://packagist.org/packages/spiral/roadrunner-tcp)[![Latest Stable Version](https://camo.githubusercontent.com/0da301ded2680e506abe26ef9b273dab1e54c2b70b2c39559e696d4a5c234256/68747470733a2f2f706f7365722e707567782e6f72672f73706972616c2f726f616472756e6e65722d7463702f762f737461626c65)](https://packagist.org/packages/spiral/roadrunner-tcp)[![phpunit](https://github.com/spiral/roadrunner-tcp/actions/workflows/phpunit.yml/badge.svg)](https://github.com/spiral/roadrunner-tcp/actions)[![psalm](https://github.com/spiral/roadrunner-tcp/actions/workflows/psalm.yml/badge.svg)](https://github.com/spiral/roadrunner-tcp/actions)[![Codecov](https://camo.githubusercontent.com/42e6072506c71576bfe2605ff030c4afedeea54873418462ced5599be70ef08f/68747470733a2f2f636f6465636f762e696f2f67682f726f616472756e6e65722d7068702f7463702f6272616e63682f342e782f67726170682f62616467652e737667)](https://codecov.io/gh/roadrunner-php/tcp)[![Total Downloads](https://camo.githubusercontent.com/fed9a7d7a40a82db6a0d69b41e6de55b5f7ff287b4c5f3b855b911ef1cef86b4/68747470733a2f2f706f7365722e707567782e6f72672f73706972616c2f726f616472756e6e65722d7463702f646f776e6c6f616473)](https://packagist.org/packages/spiral/roadrunner-tcp)[![type-coverage](https://camo.githubusercontent.com/9cccd0605ef33b454a46921efd6f64dd6a5a2b54882e49a4868ebfda179e29cc/68747470733a2f2f73686570686572642e6465762f6769746875622f726f616472756e6e65722d7068702f7463702f636f7665726167652e737667)](https://shepherd.dev/github/spiral/roadrunner-php/tcp)[![psalm-level](https://camo.githubusercontent.com/0e8a323e9c4599f45d6749a9cd99aeb6d0ebd70569da3d6a47f37e45ae1f8775/68747470733a2f2f73686570686572642e6465762f6769746875622f726f616472756e6e65722d7068702f7463702f6c6576656c2e737667)](https://shepherd.dev/github/roadrunner-php/tcp)

RoadRunner is an open-source (MIT licensed) high-performance PHP application server, load balancer, and process manager. It supports running as a service with the ability to extend its functionality on a per-project basis.

RoadRunner includes TCP server and can be used to replace classic TCP setup with much greater performance and flexibility.

 [**Official Website**](https://roadrunner.dev/) | [**Documentation**](https://docs.roadrunner.dev)

This repository contains the codebase TCP PHP workers. Check [spiral/roadrunner](https://github.com/spiral/roadrunner)to get application server.

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

[](#installation)

To install application server and TCP codebase:

```
composer require spiral/roadrunner-tcp
```

You can use the convenient installer to download the latest available compatible version of RoadRunner assembly:

```
composer require spiral/roadrunner-cli --dev
```

To download latest version of application server:

```
vendor/bin/rr get
```

Usage
-----

[](#usage)

For example, such a configuration would be quite feasible to run:

```
tcp:
  servers:
    smtp:
      addr: tcp://127.0.0.1:1025
      delimiter: "\r\n" # by default
    server2:
      addr: tcp://127.0.0.1:8889

  pool:
    num_workers: 2
    max_jobs: 0
    allocate_timeout: 60s
    destroy_timeout: 60s
```

If you have more than 1 worker in your pool TCP server will send received packets to different workers, and if you need to collect data you have to use storage, that can be accessed by all workers, for example [RoadRunner Key Value](https://github.com/spiral/roadrunner-kv)

### Example

[](#example)

To init abstract RoadRunner worker:

```
