lzpeng/hyperf-cycle
最新稳定版本:1.0.7
Composer 安装命令:
composer require lzpeng/hyperf-cycle
包简介
Cycle ORM support for hyperf
README 文档
README
Cycle ORM support for hyperf
使用Hyperf/Pool增加连接池功能
用法与CycleORM基本相同:
use Lzpeng\HyperfCycle\DatabaseManager; use Lzpeng\HyperfCycle\Config\DatabaseConfig; use Lzpeng\HyperfCycle\Config\MySQLDriverConfig; use Cycle\Database\Config\MySQL\TcpConnectionConfig; $databaseManager = new DatabaseManager( new DatabaseConfig([ 'default' => 'default', 'databases' => [ 'default' => ['connection' => 'mysql'] ], 'connections' => [ 'mysql' => new MySQLDriverConfig( connection: new TcpConnectionConfig( database: 'spiral', host: '127.0.0.1', port: 3306, user:'spiral', password: '', ), queryCache: true, // 增加了连接池配置 poolOptions: [ 'min_connections' => 1, 'max_connections' => 20, 'connect_timeout' => 10.0, 'wait_timeout' => 3.0, 'heartbeat' => -1, 'max_idle_time' => 60.0, ] ), ] ]) ); $container = /** 获取容器 **/ $schemaConfig = /** schema配置 **/; $schema = new Schema($schemaConfig); $commandGenerator = new EventDrivenCommandGenerator($schema, $container); $ormFactory = new ORMFactory($databaseManager, $schema, $commandGenerator); // 获取ORM实例 $orm = $ormFactory->orm(); // 获取EntityManager实例 $em = $ormFactory->entityManager();
统计信息
- 总下载量: 480
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-06-22