silpo-tech/openswoole-bundle
Composer 安装命令:
composer require silpo-tech/openswoole-bundle
包简介
Symfony OpenSwoole Bundle
README 文档
README
Installation
Open a command console, enter your project directory and execute:
$ composer require silpo-tech/openswoole-bundle
USAGE
# Start the openswoole server
$ php bin/console openswoole:server:start
# Stop the openswoole server
$ php bin/console openswoole:server:stop
# Reload the openswoole server
$ php bin/console openswoole:server:reload
Configuration
Default Configs
host: 0.0.0.0 port: 80 options: pid_file: /var/run/openswoole_server.pid log_file: %kernel.logs_dir%/swoole.log daemonize: false max_requests: 200 worker_num: 4 document_root: %kernel.project_dir%/public enable_static_handler: false open_http2_protocol: false open_tcp_nodelay: false # Disables Nagle's algorithm; set to true to reduce latency for small packets
Other Configs
Note: these options have not been tried
options: max_request: ~ open_cpu_affinity: ~ task_worker_num: ~ enable_port_reuse: ~ worker_num: ~ reactor_num: ~ dispatch_mode: ~ discard_timeout_request: ~ open_tcp_nodelay: ~ open_mqtt_protocol: ~ user: ~ group: ~ ssl_cert_file: ~ ssl_key_file: ~ package_max_length: ~
Testing with PHPUnit
BatchRunner automatically runs callables sequentially (without coroutines) when it detects a test environment. This avoids PHPUnit's NoTestCaseObjectOnCallStackException that occurs when mocks are invoked inside a coroutine (where debug_backtrace() cannot find the TestCase).
Sequential mode is enabled when any of these is true:
APP_ENV=test(standard Symfony test env)OPENSWOOLE_BATCH_RUNNER_SEQUENTIAL=1
To override per-instance (e.g. to test actual concurrency):
BatchRunner::fromCallables($callables)->withSequential(false)->runAll();
To override globally (e.g. in a test base class):
// Force sequential for all tests BatchRunner::forceSequential(true); // Force concurrent for all tests BatchRunner::forceSequential(false); // Restore auto-detection BatchRunner::forceSequential(null);
统计信息
- 总下载量: 3.5k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-10-02