cydrickn/swoole-runtime
最新稳定版本:v0.1.3
Composer 安装命令:
composer require cydrickn/swoole-runtime
包简介
Swoole / Openswoole Runtime
README 文档
README
A Symfony Runtime package that provides OpenSwoole integration for high-performance PHP applications. This package extends Symfony's Runtime component to support OpenSwoole server and hot reloading, enabling you to run your Symfony applications with improved performance and concurrent request handling.
Features
- OpenSwoole server integration for Symfony applications
- Support for both HTTP Kernel and callable applications
- Hot reload capability for development (optional)
- Configurable server settings
- Environment variable support for configuration
Requirements
- PHP 8.1 or higher
- OpenSwoole extension
- Symfony 7.2 or higher
Installation
You can install the package via Composer:
composer require cydrickn/runtime
Usage
Basic Usage
To use the runtime in your Symfony application, create a runtime.php file in your project root:
APP_RUNTIME=\\Cydrickn\\Runtime\\Runtime php ./public/index.php
Configuration Options
The runtime supports various configuration options that can be set either in the options array or through environment variables:
| Option | Environment Variable | Default | Description |
|---|---|---|---|
| host | SWOOLE_HOST | 127.0.0.1 | Server host address |
| port | SWOOLE_PORT | 8000 | Server port |
| mode | SWOOLE_MODE | 2 | Server mode (SWOOLE_PROCESS) |
| sock_type | SWOOLE_SOCK_TYPE | 1 | Socket type (SWOOLE_SOCK_TCP) |
| hot_reload | SWOOLE_HOT_RELOAD | 0 | Enable hot reload (1) or disable (0) |
| base_path | SWOOLE_BASE_PATH | DIR | Base path for hot reload |
Hot Reload
For development, you can enable hot reload functionality by installing the optional cydrickn/php-watcher package:
composer require --dev cydrickn/php-watcher
in your .env
SWOOLE_HOT_RELOAD=1
Using .env File
You can also add the runtime configuration to your .env file:
APP_RUNTIME=\\Cydrickn\\Runtime\\Runtime
Then run your application normally:
php ./public/index.php
Development
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
This package is open-sourced software licensed under the MIT License.
Author
- Cydrick Nonog (cydrick.dev@gmail.com)
Credits
This package is built on top of:
cydrickn/swoole-runtime 适用场景与选型建议
cydrickn/swoole-runtime 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 309 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 05 月 20 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 cydrickn/swoole-runtime 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 cydrickn/swoole-runtime 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 309
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 21
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Unknown
- 更新时间: 2025-05-20