PHPackages                             crazy-goat/workerman-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. [Framework](/categories/framework)
4. /
5. crazy-goat/workerman-bundle

ActiveSymfony-bundle[Framework](/categories/framework)

crazy-goat/workerman-bundle
===========================

Symfony bundle providing a Workerman runtime for high-performance long-running HTTP servers, with built-in task scheduler, process supervisor, PHAR packaging, and event-loop integration.

v0.23.0(1w ago)2742[30 issues](https://github.com/crazy-goat/workerman-bundle/issues)[2 PRs](https://github.com/crazy-goat/workerman-bundle/pulls)MITPHPPHP ^8.2CI passing

Since May 9Pushed 2w agoCompare

[ Source](https://github.com/crazy-goat/workerman-bundle)[ Packagist](https://packagist.org/packages/crazy-goat/workerman-bundle)[ Docs](https://github.com/crazy-goat/workerman-bundle)[ RSS](/packages/crazy-goat-workerman-bundle/feed)WikiDiscussions master Synced today

READMEChangelog (10)Dependencies (98)Versions (202)Used By (0)

Workerman runtime for Symfony applications
==========================================

[](#workerman-runtime-for-symfony-applications)

[![PHP ^8.2](https://camo.githubusercontent.com/f47350cb491f3e8b77221facbb816cbe14ec712bdf30f88c5b5622b8466d69ad/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d253545382e322d3737376262332e7376673f7374796c653d666c6174)](https://camo.githubusercontent.com/f47350cb491f3e8b77221facbb816cbe14ec712bdf30f88c5b5622b8466d69ad/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d253545382e322d3737376262332e7376673f7374796c653d666c6174)[![Symfony ^6.4|^7.0|^8.0](https://camo.githubusercontent.com/a68062b16874bc81c7baa33f7c7653a3b427a71fc9acd102d03928deef7ef88f/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f53796d666f6e792d253545362e34253743253545372e30253743253545382e302d3337343135312e7376673f7374796c653d666c6174)](https://camo.githubusercontent.com/a68062b16874bc81c7baa33f7c7653a3b427a71fc9acd102d03928deef7ef88f/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f53796d666f6e792d253545362e34253743253545372e30253743253545382e302d3337343135312e7376673f7374796c653d666c6174)[![Tests Status](https://camo.githubusercontent.com/728e6bdc080a656bf3818829349da6c4fda4e21591a665212cecdd6eee63165d/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6372617a792d676f61742f776f726b65726d616e2d62756e646c652f74657374732e79616d6c3f6272616e63683d6d6173746572)](../../actions/workflows/tests.yaml)[![License](https://camo.githubusercontent.com/fdf2982b9f5d7489dcf44570e714e3a15fce6253e0cc6b5aa61a075aac2ff71b/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d79656c6c6f772e737667)](LICENSE)

[Workerman](https://github.com/walkor/workerman) is a high-performance, asynchronous event-driven PHP framework written in pure PHP.
This bundle provides a Workerman integration in Symfony, allowing you to easily create an HTTP server, scheduler and supervisor all in one place. This bundle allows you to replace a traditional web application stack like php-fpm + nginx + cron + supervisord, all written in pure PHP (no Go, no external binaries). The request handler works in an event loop, which means the Symfony kernel and the dependency injection container are preserved between requests, making your application faster with fewer (or no) code changes.

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

[](#contributing)

Please see [CONTRIBUTING.md](https://github.com/crazy-goat/workerman-bundle/blob/master/CONTRIBUTING.md) for information about branch protection rules and development workflow.

What's new in this fork
-----------------------

[](#whats-new-in-this-fork)

This section documents the differences between [crazy-goat/workerman-bundle](https://github.com/crazy-goat/workerman-bundle) (this fork) and the upstream [luzrain/workerman-bundle](https://github.com/luzrain/workerman-bundle).

### Dependencies &amp; Compatibility

[](#dependencies--compatibility)

Aspectcrazy-goat (this fork)luzrain (upstream)PHP`^8.2``>=8.1`Symfony`^6.4^7.0PSR-7 bridge**Removed** (not required)Required (`psr/http-factory`, `psr/http-message`, `symfony/psr-http-message-bridge`)### Features

[](#features)

1. **Middleware system** — composable request/response pipeline with `MiddlewareInterface`, `MiddlewareDispatchInterface`, `StaticFilesMiddleware` (ETag, Last-Modified, 304 support, blocked extensions, dot-file blocking, symlink control, path traversal protection, LRU realpath cache with TTL, PHAR-aware path resolution), `SymfonyController` (kernel boot, request conversion, response, termination, service resetter), and a zero per-request allocation pipeline built once and cached.
2. **Console commands** — full server lifecycle management via `ServerManager`: `workerman:server start/stop/restart/reload/status/connections`, plus `workerman:build:phar` and `workerman:build:bin` for packaging.
3. **Slowloris / DoS protection** — configurable `connection_timeout` for incomplete requests (default: 120s), `keepalive_timeout` for idle connections (default: 30s), and per-server `body_size_cap`.
4. **Response conversion with strategy pattern** — `BinaryFileResponseStrategy` (uses Workerman's `withFile()`, supports `SplTempFileObject`, offset/maxlen, `deleteFileAfterSend` cleanup), `StreamedResponseStrategy` (chunked transfer encoding), `DefaultResponseStrategy` (large responses via chunked transfer directly to connection), header name normalization with caching. Upstream buffers everything in memory.
5. **Memory reload strategy** — preemptive `gc_collect_cycles()` before reload check, configurable `limit` (default 128 MB), `gc_limit` (default 96 MB), `gc_cooldown` (default 60s).
6. **Trusted hosts** — `trusted_hosts` config key with regex patterns, rejects non-matching `Host` header via `SuspiciousOperationException` (400).
7. **Service state resetter integration** — calls `services_resetter` after kernel termination to reset stateful services between requests (critical for long-running worker correctness).
8. **SSL validation** — validates cert/key paths, rejects symlinks for security.
9. **Process inspection** — `/proc`-based zombie detection, orphan killing, parent PID tracking.
10. **PHAR/BIN runtime support** — `runtime_dir` config key with `WORKERMAN_RUNTIME_DIR` env var, `PharHelper` for runtime path resolution, automatic runtime directory creation, skips file monitor in PHAR mode, `KernelFactory` with PHAR-aware `getCacheDir()`/`getLogDir()`.
11. **Custom exception hierarchy** — 21 exception classes under `WorkermanExceptionInterface` → `WorkermanException` → category bases (`ServerException`, `KernelException`, `MiddlewareException`, `SchedulerException`, `ValidationException`) with specific exceptions for every error case. Upstream uses only generic PHP exceptions.
12. **`Utils::reload()`** — programmatic worker reload from application code with `reloadAllWorkers: true` param.
13. **File upload validation** — structural validation of uploaded files with clear error messages. Upstream has no validation.
14. **Extended `Request` class** — adds `setHeader()` / `withHeader()` methods to Workerman's Request, required by the middleware system.
15. **`ListenScheme` enum** — type-safe HTTP/HTTPS/WS/WSS scheme parsing. Upstream uses inline `str_starts_with()` checks.
16. **Trigger factory improvement** — uses `CronExpression::isValidExpression()` for proper cron detection. Upstream uses a fragile heuristic (`count(explode(' ', $expr)) === 5 && str_contains($expr, '*')`).
17. **SchedulerWorker improvements** — proper SIGCHLD handler that reaps children and logs exit codes/signals, file-lock-based PID management with symlink detection and inode mismatch protection. Upstream uses `SIG_IGN` for SIGCHLD and simple `file_put_contents` for PID.
18. **SupervisorWorker improvements** — handler returns `never` type (process exits with code 1 on unexpected return), logs unexpected finish, skips processes with `processes
