mhthnz / yii2-tarantool
yii2框架的Tarantool连接器。允许执行SQL和NoSQL查询、ActiveRecord、模式等。
v1.0.9
2023-11-26 12:33 UTC
Requires
- php: ^7.2.5|^8
- rybakit/msgpack: ^0.9.1
- tarantool/client: ^0.10.0
- yiisoft/yii2: ~2.0.35
Requires (Dev)
- phpunit/phpunit: >=7
- yiisoft/yii2-debug: >=2.0.14
README
yii2框架的Tarantool连接器
Tarantool 连接器用于yii2框架。允许使用tarantool数据库执行SQL和NoSQL查询,框架抽象如ActiveRecord、Schema、TableSchema、Query、ActiveQuery等。
文档在此: docs/README.md
查看yii2基本tarantool应用程序: https://github.com/mhthnz/yii2-basic-tarantool-app
要求
如果您使用的是php 7.1,请尝试 1.0.6版本。任何后续版本都需要php 7.2。
安装
安装此扩展的首选方式是通过 composer。
运行
php composer.phar require --prefer-dist mhthnz/yii2-tarantool "*"
或添加
"mhthnz/yii2-tarantool": "*"
到您的 composer.json
文件的require部分。
配置
return [ 'bootstrap' => ['debug'], 'components' => [ // Tarantool connection setup 'tarantool' => [ 'class' => \mhthnz\tarantool\Connection::class, 'dsn' => 'tcp://username:password@localhost:3301/?connect_timeout=5&max_retries=3', ], ], 'modules' => [ //Debug panel setup 'debug' => [ 'class' => 'yii\debug\Module', 'panels' => [ 'tarantool' => [ 'class' => \mhthnz\tarantool\debug\TarantoolPanel::class, 'db' => 'tarantool', // Tarantool component id ], ], 'allowedIPs' => ['127.0.0.1', '::1'], ], ], ];
特性
- Tarantool
Connection
有Command
和QueryBuilder
ActiveRecord
模型支持ActiveQuery
Schema
抽象,TableSchema
和ColumnSchema
- 兼容AR验证器
UniqueValidator
,ExistsValidator
- 支持使用
ActiveDataProvider
的数据控件如DetailView
,ListView
,GridView
- 带解释的调试面板能够显示SQL和NoSQL请求。
- 迁移
- Nosql
Query
和Command
用于执行nosql请求 - Lua验证器
- Rbac数据库源
- 会话
- 缓存(由 expirationd,文档)
- I18n翻译源
- Gii代码生成器(ActiveRecord模型、控制器、搜索模型)
- 日志目标
未来计划
- 事务
- 连接从支持
- 队列
运行测试
- 首先您需要运行tarantool并将其绑定到localhost:3301
$ docker run --name mytarantool -p3301:3301 -d tarantool/tarantool:2.4.1
- 安装php依赖
$ sudo apt install php7.3-mbstring php7.3-dom php7.3-intl # specify php version
- 安装供应商
$ php composer install
$ php7.3 composer.phar install # or specify php version
- 运行phpunit测试
$ php ./vendor/phpunit/phpunit/phpunit --bootstrap ./tests/_bootstrap.php --configuration ./phpunit.xml.dist