tourze/workerman-runtime-context-bundle
最新稳定版本:1.0.1
Composer 安装命令:
composer require tourze/workerman-runtime-context-bundle
包简介
Workerman Runtime Context bundle
README 文档
README
A Symfony bundle that enables efficient coroutine context management for Workerman v5 event loop, providing context isolation and coroutine-friendly service integration with minimal code changes.
Features
- Seamless integration of Workerman coroutine context into Symfony applications
- Automatic context isolation for each coroutine (Fiber, Swoole, Swow)
- Support for context-aware connection pools and resource management
- Compatible with Symfony 6.4+
- Minimal or zero code modification needed in your existing Symfony app
Installation
- PHP >= 8.1
- Symfony 6.4 or higher
- Workerman >= 5.1
Install via Composer:
composer require tourze/workerman-runtime-context-bundle
Quick Start
- Enable the bundle in your Symfony application (usually auto-registered via Flex):
// config/bundles.php return [ // ... Tourze\WorkermanRuntimeContextBundle\WorkermanRuntimeContextBundle::class => ['all' => true], ];
- Use context-aware services in your code. For example, to defer a callback in coroutine:
use Tourze\Symfony\RuntimeContextBundle\Service\ContextServiceInterface; public function someMethod(ContextServiceInterface $contextService) { $contextService->defer(function () { // This will be executed at the end of the coroutine }); }
- See examples/ for advanced coroutine and context isolation usage, including Fiber, connection pool, and concurrency model tests.
Documentation
- Coroutine Context Isolation: How context is isolated between coroutines
- Connection Pool Usage: Resource sharing and reuse
- Concurrency Model Comparison: Serial, Parallel, Barrier, Channel models
Advanced Configuration
This bundle automatically decorates the default ContextServiceInterface to provide Workerman coroutine support. No manual configuration is required for most use cases.
Contributing
- Please submit issues and pull requests via GitHub
- Follow PSR coding standards and Symfony best practices
- Run tests via PHPUnit before submitting PRs
License
MIT License. See LICENSE for details.
Authors
tourze https://github.com/tourze
Changelog
See Releases for version history and upgrade notes.
统计信息
- 总下载量: 234
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-04-24