Download the PHP package aloframework/config without Composer

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

AloFramework | Config

A component that allows easy object configuration with default and overriding settings

Latest release API documentation: https://aloframework.github.io/config/

License Latest Stable Version Total Downloads

dev-develop Latest release
Dev Build Status Release Build Status
Coverage Status Coverage Status

Installation

Installation is available via Composer:

composer require aloframework/config

The abstract class

AloFramework\Config\AbstractConfig is what your own library configurations should extend. It has three main private properties: $defaults holding default configuration, $custom holding custom configuration/overrides and $merged, which holds the actual configuration that will be used. Your overriding config class will populate the default array and accept any custom variables in the constructor, e.g.:

use AloFramework\Config\AbstractConfig;

class MyConfig extends AbstractConfig {

    private static $defaultConfig = ['foo'          => 'bar',
                                     'importantVar' => 'andItsValue'];

    function __construct($customConfig = []) {
        parent::__construct(self::$defaultConfig, $customConfig);
    }
}

When reading the configuration, the values are fetched from the $merged array, which is essentially an array_merge($this->defaults, $this->custom). For more information refer to the API documentation above.

The interface

You can implement the AloFramework\Config\Configurable interface in your configuration-reading class to indicate that its runtime settings can be altered using this package. The trait described below can be used to implement the required methods.

The trait

If you don't want to write your own methods you can simply include the provided AloFramework\Config\ConfigurableTrait which will implement all the methods required by the interface.

Updating the configuration

Setting an item

You can add a custom configuration key or default setting override by calling $config->set('myKey', 'myValue'), using __set() like $config->myKey = 'myValue', or simply using it like an array: $config['myKey'] = 'myValue'.

Removing an item

You can remove custom configuration via $config->remove('myKey'), or by unsetting it like an array value: unset($config['myKey']);

Reading the configuration

Specific value

You can retrieve a specific configuration item from the merged array by calling $config->get('myKey'), using __get() like $config->myKey or by using the object like an array: $config['myKey'].

The merged config

You can retrieve the merged array via $config->getAll()

The default config

For this you would use $config->getDefaultConfig()

The custom overrides

For this you would use $config->getCustomConfig().


All versions of config with dependencies

PHP Build Version
Package Version
Requires php Version >=5.4
aloframework/common Version ^2.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 aloframework/config contains the following files

Loading the files please wait ....