Download the PHP package sergeymakinen/yii2-config without Composer

On this page you can find all versions of the php package sergeymakinen/yii2-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 yii2-config

Yii 2 config loader

Versatile config loader for Yii 2. You can define a single config definition file in your favorite language which will define a configuration for all your application tiers (console, backend, frontend, etc).

Code Quality Build Status Code Coverage SensioLabsInsight

Packagist Version Total Downloads

Table of contents

Installation

The preferred way to install this extension is through composer.

Either run

or add

to the require section of your composer.json file.

Usage

First you need to define your config: it may be a PHP array right in the file you plan to include it in but it's better to place it in a file which can be in any example.

Then your entry scripts have to be modified to load the config. It's how it can look like for a console tier basic project template:

And for a backend tier advanced application template:

Example config

Consider this config:

Config will look for the following config files in CONFIG_DIR and CONFIG_DIR/ENV directories:

Shortcuts

As you can see in the example section there are different ways to specify a config file configuration. To be able to write less, some common options can be written in a single string instead of an array.

'TIER:ENV@KEY' => 'PATH' will be resolved as (you can omit any part you don't need):

Samples:

Shortcut Result
'bar'
[
    'path' => 'bar',
]
'foo' => 'bar'
[
    'env' => 'foo',
    'path' => 'bar',
]
'foo@baz' => 'bar'
[
    'env' => 'foo',
    'key' => 'baz',
    'path' => 'bar',
]
'loren:foo@baz' => 'bar'
[
    'tier' => 'loren',
    'env' => 'foo',
    'key' => 'baz',
    'path' => 'bar',
]

Supported config formats

INI

Extension: ini

Loader class: sergeymakinen\yii\config\IniLoader

Example:

JSON

Extension: json

Loader class: sergeymakinen\yii\config\JsonLoader

Example:

PHP array

Extension: php

Loader class: sergeymakinen\yii\config\PhpArrayLoader

Example:

PHP bootstrap

Extension: php

Loader class: sergeymakinen\yii\config\PhpBootstrapLoader

Attention: you need to explicitly set the class name to use this loader:

Example:

YAML

Extension: yml, yaml

Loader class: sergeymakinen\yii\config\YamlLoader

Attention: you need to install the Symfony YAML library:

Either run

or add

to the require section of your composer.json file.

Example:

Extending

For example let's try to write a simple XML loader:

If you wish to use the loader automatically for XML files then add the following entry to the loaders property array of Config:


All versions of yii2-config with dependencies

PHP Build Version
Package Version
Requires yiisoft/yii2 Version ~2.0.13
sergeymakinen/yii2-php-file-cache Version ^2.1
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 sergeymakinen/yii2-config contains the following files

Loading the files please wait ....