Download the PHP package yii2tech/config without Composer

On this page you can find all versions of the php package yii2tech/config. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package config

Application Runtime Configuration Extension for Yii 2


This extension provides support for application runtime configuration, loading config from database.

For license information check the LICENSE-file.

Latest Stable Version Total Downloads Build Status

Installation

The preferred way to install this extension is through composer.

Either run

or add

to the require section of your composer.json.

Usage

This extension allows reconfigure already created Yii application instance using config composed from external storage like relational database, MongoDB and so on. It allows to reconfigure any application property, component or module. Configuration is performed by [[\yii2tech\config\Manager]] component, which should be added to the application configuration. For example:

[[\yii2tech\config\Manager]] implements [[\yii\base\BootstrapInterface]] interface, thus being placed under 'bootstrap' section it will apply runtime configuration during application bootstrap. You can apply config manually to the application or any [[\yii\base\Module]] descendant, using following code:

Configuration items specification

Application parts, which should be reconfigured are determined by [[\yii2tech\config\Manager::$items]], which is a list of [[\yii2tech\config\Item]]. Each configuration item determines the configuration path - a list of keys in application configuration array, which leads to the target value. For example: path 'components.formatter.nullDisplay' (or ['components', 'formatter', 'nullDisplay']) points to the property 'nullDisplay' of [[\yii\i18n\Formatter]] component, path 'name' points to [[\yii\base\Application::name]] and so on.

Note: if no path is specified it will be considered as a key inside [[\yii\base\Module::$params]] array, which matches configuration item id (name of key in [[\yii2tech\config\Manager::$items]] array).

Configuration item may also have several properties, which supports creation of web interface for configuration setup. These are:

Here are some examples of item specifications:

Tip: since runtime configuration may consist of many items and their declaration may cost a lot of code, it can be moved into a separated file and specified by this file name.

Configuration storage

Declared configuration items may be saved into persistent storage and then retrieved from it. The actual item storage is determined via [[\yii2tech\config\Manager::storage]].

Following storages are available:

Please refer to the particular storage class for more details.

Creating configuration web interface

The most common use case for this extension is creating a web interface, which allows control of application configuration in runtime. [[\yii2tech\config\Manager]] serves not only for applying of the configuration - it also helps to create an interface for configuration editing.

The web controller for configuration management may look like following:

The main view file can be following:

Standalone configuration

[[\yii2tech\config\Manager]] can be used not only for application configuration storage: it may hold any abstract configuration set for any standalone task. You can configure manager as an application component, which stores some user settings as use it to retrieve it. For example:

php if (Yii::$app->userInterfaceConfig->getItemValue('sidebarEnabled')) { // render sidebar }

echo Yii::$app->userInterfaceConfig->getItemValue('backgroundColor');



Note that you should enable [[\yii2tech\config\Manager::$autoRestoreValues]] to make configuration values to be
restored from persistent storage automatically, otherwise you'll have to invoke [[\yii2tech\config\Manager::restoreValues()]]
method manually. Also do not forget to specify default value for each configuration item, otherwise it will be picked up
from current application.

You may also use [[\yii2tech\config\Manager]] to configure particular component. For example:

In above example fields `isEnabled` and `color` will always be configured from persistent storage.

All versions of config with dependencies

PHP Build Version
Package Version
Requires yiisoft/yii2 Version ~2.0.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package yii2tech/config contains the following files

Loading the files please wait ....