PHPackages                             tourze/workerman-server-bundle - 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. tourze/workerman-server-bundle

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

tourze/workerman-server-bundle
==============================

Workerman + Symfony

1.3.1(6mo ago)10471[2 issues](https://github.com/tourze/workerman-server-bundle/issues)[1 PRs](https://github.com/tourze/workerman-server-bundle/pulls)MITPHPCI passing

Since Mar 15Pushed 5mo ago1 watchersCompare

[ Source](https://github.com/tourze/workerman-server-bundle)[ Packagist](https://packagist.org/packages/tourze/workerman-server-bundle)[ RSS](/packages/tourze-workerman-server-bundle/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (37)Versions (16)Used By (0)

Workerman Server Bundle
=======================

[](#workerman-server-bundle)

[English](README.md) | [中文](README.zh-CN.md)

[![Latest Version](https://camo.githubusercontent.com/244482526d6f07de04ba9fd14a8d4be1b09713fddfd20883ab722244f6edc4b0/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f746f75727a652f776f726b65726d616e2d7365727665722d62756e646c652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/tourze/workerman-server-bundle)[![Total Downloads](https://camo.githubusercontent.com/aec8512adf6af55994306ca6ccb250203e8826d004bcc1b7ae5ac00c0a72541e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f746f75727a652f776f726b65726d616e2d7365727665722d62756e646c652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/tourze/workerman-server-bundle)[![PHP Version](https://camo.githubusercontent.com/8c6663466bb88ec255ceeb459861c4a1c53ac0dacdab7e218679dffd431e1b84/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f746f75727a652f776f726b65726d616e2d7365727665722d62756e646c652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/tourze/workerman-server-bundle)[![License](https://camo.githubusercontent.com/bf57544220f999f4c65a8dcfaca07d2ff8a166ea07f787ad1387cb2c9c31c42a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f746f75727a652f776f726b65726d616e2d7365727665722d62756e646c652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/tourze/workerman-server-bundle)[![Code Coverage](https://camo.githubusercontent.com/bc8ea51066e190920cbc8cf6451f9af7118c804aeb83ac4cea6feb81f711580a/68747470733a2f2f696d672e736869656c64732e696f2f636f6465636f762f632f6769746875622f746f75727a652f776f726b65726d616e2d7365727665722d62756e646c653f7374796c653d666c61742d737175617265)](https://codecov.io/gh/tourze/workerman-server-bundle)

A high-performance HTTP server for Symfony applications using Workerman. Make your Symfony application faster with minimal changes.

Table of Contents
-----------------

[](#table-of-contents)

- [Features](#features)
- [Requirements](#requirements)
- [Installation](#installation)
- [Quick Start](#quick-start)
- [Commands](#commands)
- [Architecture](#architecture)
- [Performance Optimizations](#performance-optimizations)
- [Development Mode](#development-mode)
- [Production Deployment](#production-deployment)
- [Advanced Usage](#advanced-usage)
- [Troubleshooting](#troubleshooting)
- [Contributing](#contributing)
- [License](#license)

Features
--------

[](#features)

- **High Performance**: Built on Workerman's event-driven architecture
- **Symfony Integration**: Full support for Symfony's request/response lifecycle
- **Static File Serving**: Automatic static file serving with MIME type detection
- **Long-lived Connections**: HTTP keep-alive support
- **Process Management**: Built-in process management (start/stop/restart/reload)
- **Auto-reload**: File monitoring and auto-reload in development mode
- **Memory Protection**: Automatic worker restart after max requests
- **PSR Standards**: PSR-7, PSR-15, PSR-17 compliant

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

[](#requirements)

- PHP 8.1+
- Symfony 6.4+
- ext-pcntl
- ext-posix
- ext-fileinfo

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

[](#installation)

```
composer require tourze/workerman-server-bundle
```

Add the bundle to your `config/bundles.php`:

```
return [
    // ...
    Tourze\WorkermanServerBundle\WorkermanServerBundle::class => ['all' => true],
];
```

Quick Start
-----------

[](#quick-start)

### Starting the HTTP Server

[](#starting-the-http-server)

```
# Start the server
php bin/console workerman:http start

# Start as daemon
php bin/console workerman:http start -d

# Stop the server
php bin/console workerman:http stop

# Restart the server
php bin/console workerman:http restart

# Check server status
php bin/console workerman:http status

# Reload workers (graceful restart)
php bin/console workerman:http reload

# View connection details
php bin/console workerman:http connections
```

The server will start on `http://127.0.0.1:8080` by default.

Commands
--------

[](#commands)

### workerman:http

[](#workermanhttp)

The main command to manage the Workerman HTTP server.

**Description**: Start Workerman HTTP server for your Symfony application

**Usage**:

```
php bin/console workerman:http
```

**Available actions**:

- `start`: Start the server
- `stop`: Stop the server
- `restart`: Restart the server
- `status`: Show server status
- `reload`: Gracefully reload all workers
- `connections`: Show current connections

**Options**:

- `-d`: Run as daemon (for start/restart actions)

**Features**:

- Serves both dynamic Symfony routes and static files
- Automatic worker restart after 10,000 requests (configurable)
- File monitoring in debug mode for auto-reload
- Integrated Messenger consumer support
- Keep-alive connection support

Architecture
------------

[](#architecture)

### Request Flow

[](#request-flow)

1. Workerman receives HTTP request
2. Request is converted to PSR-7 ServerRequest
3. Static file check (serves from `public/` directory if exists)
4. PSR-7 request is converted to Symfony Request
5. Symfony kernel handles the request
6. Symfony Response is converted to PSR-7 Response
7. Response is sent back through Workerman
8. Kernel terminate event is triggered

### Components

[](#components)

- **WorkermanHttpCommand**: Console command for server management
- **OnMessage**: Core request handler
- **PsrRequestFactory**: Converts Workerman requests to PSR-7
- **WorkermanResponseEmitter**: Sends PSR-7 responses to clients
- **ProperHeaderCasingResponseFactory**: Ensures proper HTTP header casing

Performance Optimizations
-------------------------

[](#performance-optimizations)

1. **Memory Management**: Workers automatically restart after processing 10,000 requests
2. **File Monitoring**: Only enabled in debug mode to avoid overhead
3. **Static File Serving**: Direct file serving bypasses Symfony kernel
4. **Connection Reuse**: HTTP keep-alive reduces connection overhead
5. **Error Tracking**: Optimized backtrace with ignored vendor files

Development Mode
----------------

[](#development-mode)

In development mode (`APP_ENV=dev`), the bundle provides:

- Automatic file monitoring for changes in:
    - `config/`
    - `src/`
    - `templates/`
    - `translations/`
- Auto-reload when PHP, YAML files change
- Detailed error output

Production Deployment
---------------------

[](#production-deployment)

For production use:

```
# Start as daemon with production environment
APP_ENV=prod php bin/console workerman:http start -d

# Monitor server status
php bin/console workerman:http status

# Graceful reload without downtime
php bin/console workerman:http reload
```

Advanced Usage
--------------

[](#advanced-usage)

### Custom Request Handlers

[](#custom-request-handlers)

You can extend the request handling by implementing PSR-15 middleware:

```
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Server\RequestHandlerInterface;

class CustomHandler implements RequestHandlerInterface
{
    public function handle(ServerRequestInterface $request): ResponseInterface
    {
        // Your custom logic here
    }
}
```

### Integration with Symfony Messenger

[](#integration-with-symfony-messenger)

The bundle automatically starts a Messenger consumer worker when the HTTP server starts, allowing you to process async messages without separate processes.

Troubleshooting
---------------

[](#troubleshooting)

### Server won't start

[](#server-wont-start)

- Check if port 8080 is already in use
- Ensure PHP has pcntl and posix extensions enabled
- Check file permissions for pid and log files

### High memory usage

[](#high-memory-usage)

- Reduce max request count per worker
- Check for memory leaks in your application code
- Monitor with `workerman:http status`

Contributing
------------

[](#contributing)

Contributions are welcome! Please feel free to submit a Pull Request.

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE) for more information.

###  Health Score

40

—

FairBetter than 88% of packages

Maintenance67

Regular maintenance activity

Popularity16

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity56

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 ~95 days

Recently: every ~50 days

Total

15

Last Release

186d ago

PHP version history (2 changes)1.0.0PHP &gt;=7.2

1.0.2PHP ^8.1

### Community

Maintainers

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

---

Top Contributors

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

---

Tags

symfonyworkerman

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/tourze-workerman-server-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/tourze-workerman-server-bundle/health.svg)](https://phpackages.com/packages/tourze-workerman-server-bundle)
```

###  Alternatives

[shopware/platform

The Shopware e-commerce core

3.3k1.5M3](/packages/shopware-platform)[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

595.2M386](/packages/shopware-core)[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.4k5.6M651](/packages/sylius-sylius)[sulu/sulu

Core framework that implements the functionality of the Sulu content management system

1.3k1.3M152](/packages/sulu-sulu)[contao/core-bundle

Contao Open Source CMS

1231.6M2.4k](/packages/contao-core-bundle)[prestashop/prestashop

PrestaShop is an Open Source e-commerce platform, committed to providing the best shopping cart experience for both merchants and customers.

9.0k15.4k](/packages/prestashop-prestashop)

PHPackages © 2026

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