mhthnz/yii2-tarantool

yii2框架的Tarantool连接器。允许执行SQL和NoSQL查询、ActiveRecord、模式等。

安装: 381

依赖关系: 0

建议者: 0

安全: 0

星标: 14

关注者: 3

分支: 3

开放问题: 2

类型:yii2-extension

v1.0.9 2023-11-26 12:33 UTC

This package is auto-updated.

Last update: 2024-09-26 15:17:06 UTC


README

YiiFramework

yii2框架的Tarantool连接器

Latest Stable Version Latest Unstable Version Master Branch Tests Score Coverage

Tarantool 连接器用于yii2框架。允许使用tarantool数据库执行SQL和NoSQL查询,框架抽象如ActiveRecord、Schema、TableSchema、Query、ActiveQuery等。

文档在此: docs/README.md

查看yii2基本tarantool应用程序: https://github.com/mhthnz/yii2-basic-tarantool-app

要求

Packagist PHP Version Support Tarantool version Yii2 version

如果您使用的是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并将其绑定到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