Download the PHP package werx/config without Composer

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

werx\config

Build Status Total Downloads Latest Stable Version

Use environment-specific configuration files in your app.

Features:

Basic Usage

Recommended Directory Structure

For the default config providers, you'll need to create a directory structure somewhere in your project to hold your configuration files.

Recommended structure:

Default configs go in the root config directory. There must also sub-directories for each environment (local/test/prod) if you want to override the default setting when running in different environments.

Using ArrayProvider

Create a .php file in your config directory that returns an array of config values.

Get an instance of the ArrayProvider class, passing the path to your config directory to the constructor.

Using JsonProvider

Create a .json file in your config directory that returns an array of config values.

Get an instance of the JsonProvider class, passing the path to your config directory to the constructor.

Loading A Configuration Group

In this example, you would be loading the array from config.php in your config directory.

Get A Configuration Value

Get A Default Value

If a configuration item doesn't exist, $config->get() will return null. You can override the default return value by passing the new default as the 2nd parameter.

Loading Environment-Specific Configuration Group

In this example, you would be loading the array from config.php and test/config.php. Keys from test/config.php will merge with the keys from config.php.

Note: The merge strategy is similar to that of PHP's native array_merge strategy in that keys in the environment-specific config with the same name as those in the default config replace the ones in the default. This merge is recursive, so nested keys follow the same logic as well.

Loading Multiple Configuration Groups

If you have more than one configuration group to load, you can call load() multiple times, or you can pass an array of config groups.

Avoiding Collisions On Config Property Names

By default, if a configuration property name is found in multiple config files, the config value will be replaced each time that property name is found in a config file. If you prefer, you can tell the loader to index the config container with the name of the config group to prevent name collisions. This is accomplished by passing true as the second parameter to load().

Then to retrieve your indexed property name, call the "magic" method named the same as the config file you loaded.

As with the get() method, the seond parameter above is the default value if the config item doesn't exist.

Or you can return all of the items in the 'email' config group as an array by not passing any parameters.

Installation

This package is installable and autoloadable via Composer as werx/config. If you aren't familiar with the Composer Dependency Manager for PHP, you should read this first.

Contributing

Unit Testing

Coding Standards

This library uses PHP_CodeSniffer to ensure coding standards are followed.

I have adopted the PHP FIG PSR-2 Coding Standard EXCEPT for the tabs vs spaces for indentation rule. PSR-2 says 4 spaces. I use tabs. No discussion.

To support indenting with tabs, I've defined a custom PSR-2 ruleset that extends the standard PSR-2 ruleset used by PHP_CodeSniffer. You can find this ruleset in the root of this project at PSR2Tabs.xml

Executing the codesniffer command from the root of this project to run the sniffer using these custom rules.

$ ./codesniffer

All versions of config with dependencies

PHP Build Version
Package Version
Requires php Version >= 5.4
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 werx/config contains the following files

Loading the files please wait ....