horat1us / yii2-current-environment
Yii2 Current Environment Provider
Requires
- php: ^7.4 | 8.*
- ext-json: *
- symfony/polyfill-php80: ^1.20
- yiisoft/yii2: ^2.0.39.3
Requires (Dev)
- horat1us/yii2-asset-free: ^1.0
- phpunit/phpunit: ^9.5
- squizlabs/php_codesniffer: ^3.5
This package is auto-updated.
Last update: 2024-12-22 13:20:48 UTC
README
Русская версия Library provides class to get current environment (YII_ENV) of Yii2 application.
Purpose
Main purpose is to make support, adaptation and modification of applications written using legacy Yii2 framework more friendly to modern programming trends.
PHP constants is used for configuring Yii2 applications environment. It makes testing environment-depending code difficult because constant redefining is impossible without external extensions.
This library provides simple solution for legacy application written using Yii2 as facade class that deals with Yii2 legacy (constant defining in libraries, global variables and static class storage).
Install
Using composer
composer install horat1us/yii2-current-environment
Setup
For usage inside libraries
Use CurrentEnvironment\Facade as dependency for your services in pair with DI Container.
For usage inside application
To set up CurrentEnvironment\Facade singleton inside Yii2 DI Container, both with 'env' application component use CurrentEnvironment\Bootstrap inside your application configuration.