{"id":36976107,"url":"https://github.com/tourze/workerman-server-bundle","last_synced_at":"2026-01-13T22:08:07.571Z","repository":{"id":45981229,"uuid":"470149301","full_name":"tourze/workerman-server-bundle","owner":"tourze","description":"Run symfony on workerman","archived":false,"fork":false,"pushed_at":"2025-11-07T14:03:45.000Z","size":122,"stargazers_count":10,"open_issues_count":2,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-11-07T16:08:45.780Z","etag":null,"topics":["symfony","workerman"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tourze.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2022-03-15T12:27:20.000Z","updated_at":"2025-11-07T14:02:52.000Z","dependencies_parsed_at":"2025-04-17T10:54:18.493Z","dependency_job_id":"62ffbf2e-5ccf-47e5-9c48-9c6723e9f684","html_url":"https://github.com/tourze/workerman-server-bundle","commit_stats":null,"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"purl":"pkg:github/tourze/workerman-server-bundle","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tourze%2Fworkerman-server-bundle","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tourze%2Fworkerman-server-bundle/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tourze%2Fworkerman-server-bundle/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tourze%2Fworkerman-server-bundle/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tourze","download_url":"https://codeload.github.com/tourze/workerman-server-bundle/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tourze%2Fworkerman-server-bundle/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28402208,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-13T14:36:09.778Z","status":"ssl_error","status_checked_at":"2026-01-13T14:35:19.697Z","response_time":56,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["symfony","workerman"],"created_at":"2026-01-13T22:08:07.106Z","updated_at":"2026-01-13T22:08:07.562Z","avatar_url":"https://github.com/tourze.png","language":"PHP","readme":"# Workerman Server Bundle\n\n[English](README.md) | [中文](README.zh-CN.md)\n\n[![Latest Version](https://img.shields.io/packagist/v/tourze/workerman-server-bundle.svg?style=flat-square)](https://packagist.org/packages/tourze/workerman-server-bundle)\n[![Total Downloads](https://img.shields.io/packagist/dt/tourze/workerman-server-bundle.svg?style=flat-square)](https://packagist.org/packages/tourze/workerman-server-bundle)\n[![PHP Version](https://img.shields.io/packagist/php-v/tourze/workerman-server-bundle.svg?style=flat-square)](https://packagist.org/packages/tourze/workerman-server-bundle)\n[![License](https://img.shields.io/packagist/l/tourze/workerman-server-bundle.svg?style=flat-square)](https://packagist.org/packages/tourze/workerman-server-bundle)\n[![Code Coverage](https://img.shields.io/codecov/c/github/tourze/workerman-server-bundle?style=flat-square)](https://codecov.io/gh/tourze/workerman-server-bundle)\n\nA high-performance HTTP server for Symfony applications using Workerman. Make your Symfony application faster with minimal changes.\n\n## Table of Contents\n\n- [Features](#features)\n- [Requirements](#requirements)\n- [Installation](#installation)\n- [Quick Start](#quick-start)\n- [Commands](#commands)\n- [Architecture](#architecture)\n- [Performance Optimizations](#performance-optimizations)\n- [Development Mode](#development-mode)\n- [Production Deployment](#production-deployment)\n- [Advanced Usage](#advanced-usage)\n- [Troubleshooting](#troubleshooting)\n- [Contributing](#contributing)\n- [License](#license)\n\n## Features\n\n- **High Performance**: Built on Workerman's event-driven architecture\n- **Symfony Integration**: Full support for Symfony's request/response lifecycle\n- **Static File Serving**: Automatic static file serving with MIME type detection\n- **Long-lived Connections**: HTTP keep-alive support\n- **Process Management**: Built-in process management (start/stop/restart/reload)\n- **Auto-reload**: File monitoring and auto-reload in development mode\n- **Memory Protection**: Automatic worker restart after max requests\n- **PSR Standards**: PSR-7, PSR-15, PSR-17 compliant\n\n## Requirements\n\n- PHP 8.1+\n- Symfony 6.4+\n- ext-pcntl\n- ext-posix\n- ext-fileinfo\n\n## Installation\n\n```bash\ncomposer require tourze/workerman-server-bundle\n```\n\nAdd the bundle to your `config/bundles.php`:\n\n```php\nreturn [\n    // ...\n    Tourze\\WorkermanServerBundle\\WorkermanServerBundle::class =\u003e ['all' =\u003e true],\n];\n```\n\n## Quick Start\n\n### Starting the HTTP Server\n\n```bash\n# Start the server\nphp bin/console workerman:http start\n\n# Start as daemon\nphp bin/console workerman:http start -d\n\n# Stop the server\nphp bin/console workerman:http stop\n\n# Restart the server\nphp bin/console workerman:http restart\n\n# Check server status\nphp bin/console workerman:http status\n\n# Reload workers (graceful restart)\nphp bin/console workerman:http reload\n\n# View connection details\nphp bin/console workerman:http connections\n```\n\nThe server will start on `http://127.0.0.1:8080` by default.\n\n## Commands\n\n### workerman:http\n\nThe main command to manage the Workerman HTTP server.\n\n**Description**: Start Workerman HTTP server for your Symfony application\n\n**Usage**:\n```bash\nphp bin/console workerman:http \u003caction\u003e\n```\n\n**Available actions**:\n- `start`: Start the server\n- `stop`: Stop the server\n- `restart`: Restart the server\n- `status`: Show server status\n- `reload`: Gracefully reload all workers\n- `connections`: Show current connections\n\n**Options**:\n- `-d`: Run as daemon (for start/restart actions)\n\n**Features**:\n- Serves both dynamic Symfony routes and static files\n- Automatic worker restart after 10,000 requests (configurable)\n- File monitoring in debug mode for auto-reload\n- Integrated Messenger consumer support\n- Keep-alive connection support\n\n## Architecture\n\n### Request Flow\n\n1. Workerman receives HTTP request\n2. Request is converted to PSR-7 ServerRequest\n3. Static file check (serves from `public/` directory if exists)\n4. PSR-7 request is converted to Symfony Request\n5. Symfony kernel handles the request\n6. Symfony Response is converted to PSR-7 Response\n7. Response is sent back through Workerman\n8. Kernel terminate event is triggered\n\n### Components\n\n- **WorkermanHttpCommand**: Console command for server management\n- **OnMessage**: Core request handler\n- **PsrRequestFactory**: Converts Workerman requests to PSR-7\n- **WorkermanResponseEmitter**: Sends PSR-7 responses to clients\n- **ProperHeaderCasingResponseFactory**: Ensures proper HTTP header casing\n\n## Performance Optimizations\n\n1. **Memory Management**: Workers automatically restart after processing 10,000 requests\n2. **File Monitoring**: Only enabled in debug mode to avoid overhead\n3. **Static File Serving**: Direct file serving bypasses Symfony kernel\n4. **Connection Reuse**: HTTP keep-alive reduces connection overhead\n5. **Error Tracking**: Optimized backtrace with ignored vendor files\n\n## Development Mode\n\nIn development mode (`APP_ENV=dev`), the bundle provides:\n- Automatic file monitoring for changes in:\n  - `config/`\n  - `src/`\n  - `templates/`\n  - `translations/`\n- Auto-reload when PHP, YAML files change\n- Detailed error output\n\n## Production Deployment\n\nFor production use:\n\n```bash\n# Start as daemon with production environment\nAPP_ENV=prod php bin/console workerman:http start -d\n\n# Monitor server status\nphp bin/console workerman:http status\n\n# Graceful reload without downtime\nphp bin/console workerman:http reload\n```\n\n## Advanced Usage\n\n### Custom Request Handlers\n\nYou can extend the request handling by implementing PSR-15 middleware:\n\n```php\nuse Psr\\Http\\Message\\ResponseInterface;\nuse Psr\\Http\\Message\\ServerRequestInterface;\nuse Psr\\Http\\Server\\RequestHandlerInterface;\n\nclass CustomHandler implements RequestHandlerInterface\n{\n    public function handle(ServerRequestInterface $request): ResponseInterface\n    {\n        // Your custom logic here\n    }\n}\n```\n\n### Integration with Symfony Messenger\n\nThe bundle automatically starts a Messenger consumer worker when the HTTP server starts, allowing you to process async messages without separate processes.\n\n## Troubleshooting\n\n### Server won't start\n- Check if port 8080 is already in use\n- Ensure PHP has pcntl and posix extensions enabled\n- Check file permissions for pid and log files\n\n### High memory usage\n- Reduce max request count per worker\n- Check for memory leaks in your application code\n- Monitor with `workerman:http status`\n\n## Contributing\n\nContributions are welcome! Please feel free to submit a Pull Request.\n\n## License\n\nThe MIT License (MIT). Please see [License File](LICENSE) for more information.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftourze%2Fworkerman-server-bundle","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftourze%2Fworkerman-server-bundle","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftourze%2Fworkerman-server-bundle/lists"}