wearesho-team / yii2-stateless
This package is abandoned and no longer maintained.
No replacement package was suggested.
Stateless components factory for Yii2
3.1.0
2018-05-22 14:34 UTC
Requires
- php: >=7.2.0
- horat1us/environment-config: ^1.2.1
- yiisoft/yii2: ^2.0.14
- yiisoft/yii2-redis: ~2.0
Requires (Dev)
- phpunit/phpunit: ^7.1
- squizlabs/php_codesniffer: ^3.2
This package is auto-updated.
Last update: 2020-08-25 20:19:24 UTC
README
This package provides single class Wearesho\Yii\Stateless\Factory
with:
getRedis
- returns Redis connection or null, depends on Redis\ConfigInterfacegetSession
- return\yii\web\Session
or\yii\redis\Session
, if Redis availablegetCache
- returns\yii\caching\FileCache
or\yii\redis\Cache
, if Redis availablegetDb
- returns\yii\db\Connection
depends on Db\ConfigInterface
Note:
- Redis\ConfigInterface have Redis\EnvironmentConfig implementation
Environment variables to make redis available:
-
REDIS_HOSTNAME - required
-
REDIS_DATABASE - required
-
REDIS_PASSWORD - default empty
-
REDIS_PORT - default 6379
-
Db\ConfigInterface have Db\EnvironmentConfig implementation
Environment variables to instantiate database:
- DB_HOST - database host or ip
- DB_NAME - database name
- DB_USER - database user
- DB_PORT - port for connection (default 3306 for MySQL, 5432 for PostgreSQL)
- DB_TYPE - type of database (default pgsql)
- DB_PASSWORD - database user password (default null)
You can copy .env.example to your project
Installation
composer require wearesho-team/yii-stateless:^3.0
Usage
<?php // your bootstrap.php file use Wearesho\Yii\Stateless; Stateless\Configurator::configure(\Yii::$container);
<?php // your main.php file use Wearesho\Yii\Stateless; $config = [ // Your Application configuration ]; return array_merge(Stateless\Configurator::config(\Yii::$container), $config);
For advanced usage
License
MIT