tourze/workerman-doctrine-bundle
最新稳定版本:0.0.3
Composer 安装命令:
composer require tourze/workerman-doctrine-bundle
包简介
Workerman + DoctrineORM
README 文档
README
A Symfony bundle that provides integration between Workerman and Doctrine ORM, ensuring proper entity manager lifecycle management in long-running processes.
Features
- Entity Manager Monitoring: Automatically monitors Doctrine EntityManager state in Workerman processes
- Process Protection: Automatically stops Workerman processes when EntityManager is closed to prevent data corruption
- Seamless Integration: Works with both HTTP and Console events
- Zero Configuration: Works out of the box with minimal setup
Installation
composer require tourze/workerman-doctrine-bundle
Quick Start
- Add the bundle to your
config/bundles.php:
<?php return [ // ... other bundles Tourze\WorkermanDoctrineBundle\WorkermanDoctrineBundle::class => ['all' => true], ];
- The bundle will automatically register its services and event listeners.
How It Works
The bundle includes an EntityManagerWatchSubscriber that monitors the Doctrine EntityManager state:
- Automatic Monitoring: Listens to
KernelEvents::TERMINATEandConsoleEvents::TERMINATEevents - Process Safety: When the EntityManager is closed (usually due to an exception), the subscriber automatically stops all Workerman processes
- Clean Shutdown: Prevents data corruption by ensuring processes restart with a fresh EntityManager
Use Cases
This bundle is particularly useful when:
- Running Symfony applications with Workerman in long-running processes
- Needing to ensure database connection stability
- Preventing EntityManager-related issues in high-concurrency scenarios
- Building robust long-running web services
Requirements
- PHP 8.1 or higher
- Symfony 6.4 or higher
- Doctrine ORM 3.0 or higher
- Workerman 5.1 or higher
- ext-pcntl extension
Contributing
Please see CONTRIBUTING.md for details.
License
The MIT License (MIT). Please see License File for more information.
统计信息
- 总下载量: 12
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-04-21