Download the PHP package ckr/config without Composer

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

Configuration Library

Build Status

This package provides a class to manage hierarchical data. A common use case is configuration data.

Note that this package does not provide any readers or writers for config files of different formats. Instead it wraps php arrays and provides easier access to its values.

Why?

I was tired of using too many isset throghout all my code. The main advantage of this library is, that you can request an arbitrary deeply nested value, and provide a default value which should be returned in case the requested value does not exist:

Actually, if you're using PHP7, this problem is solved:

However, as I prefer to specify the path as root/specific/key instead of ['root']['specific']['key'], I still use this library in my PHP7 projects.

Usage

You start with a hierarchical data structure, defined as multi dimensional array:

Then you can wrap it in a Config object:

You can ask for a simple value with get:

In the example above, "dev" is the default mode. It is returned, if the key 'mode' does not exist in the config data.

You can ask for a value which is nested in a child array by providing a path of keys, separated by a Slash /:

If any of the used path parts (keys) don't exist, the default value (null if not explicitly specified) is returned.

Say you want to use all of the logging data, e.g. to instantiate your logging instance. For this, you can get a child config object:

To summarize:

A new value can be set using Config::set:

This method returns a new instance with a specific part of the config updated (or newly set). This may be useful if you want to construct a complete configuration object in multiple steps from different parts of your code, e.g. to allow different modules to register their configuration or factories. In the above example, $newConfig has a value of 'AnotherFactoryClass' at the path logging/factory, where the $c instance is not modified and still has the old value. (Note that this behaviour is new in Version 2.0, former versions did update the data in place).


All versions of config with dependencies

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

Loading the files please wait ....