mhthnz / yii2-tarantool
Tarantool connector for yii2 framework. Allows to perform SQL and NoSQL queries, ActiveRecord, Schemas and more.
Installs: 385
Dependents: 0
Suggesters: 0
Security: 0
Stars: 12
Watchers: 3
Forks: 3
Open Issues: 2
Type:yii2-extension
pkg:composer/mhthnz/yii2-tarantool
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
Tarantool connector for yii2 framework
Tarantool connector for yii2 framework. Allows to perform SQL and NoSQL queries, framework abstractions such as ActiveRecord, Schema, TableSchema, Query, ActiveQuery and etc using tarantool database.
Documentation is here: docs/README.md
Check out yii2 basic tarantool application: https://github.com/mhthnz/yii2-basic-tarantool-app
Reqirements
If you are using php 7.1, try 1.0.6 version. Any later versions require php 7.2.
Installation
The preferred way to install this extension is through composer.
Either run
php composer.phar require --prefer-dist mhthnz/yii2-tarantool "*"
or add
"mhthnz/yii2-tarantool": "*"
to the require section of your composer.json file.
Configuration
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'], ], ], ];
Features
- Tarantool
ConnectionhasCommandandQueryBuilder ActiveRecordmodels withActiveQuerysupportSchemaabstraction,TableSchemaandColumnSchema- Compatible with AR validators
UniqueValidator,ExistsValidator - Supports data widgets like
DetailView,ListView,GridViewusingActiveDataProvider - Debug panel with explain is able to show SQL and NoSQL requests.
- Migrations
- Nosql
QueryandCommandfor performing nosql requests - Lua validator
- Rbac db source
- Session
- Cache (by expirationd, docs)
- I18n translate source
- Gii code generator (ActiveRecord models, controllers, search models)
- Log target
Future plans
- Transactions
- Connection slaves support
- Queue
Running tests
- First of all you need to run tarantool and bind it to localhost:3301
$ docker run --name mytarantool -p3301:3301 -d tarantool/tarantool:2.4.1
- Install php deps
$ sudo apt install php7.3-mbstring php7.3-dom php7.3-intl # specify php version
- Install vendor
$ php composer install
$ php7.3 composer.phar install # or specify php version
- Run phpunit tests
$ php ./vendor/phpunit/phpunit/phpunit --bootstrap ./tests/_bootstrap.php --configuration ./phpunit.xml.dist