Download the PHP package assertis/config-lib without Composer
On this page you can find all versions of the php package assertis/config-lib. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package config-lib
Simple configuration library
Design
Configuration library enables you to load configurations into application from different source, it give you way to validate configuration on developer environment.
We are providing 5 base type of configurations.
-
Assertis\Configuration\Drivers\SourceDriver: simple driver, you can set array with configuration into constructor. -
Assertis\Configuration\Drivers\DatabaseDriver: driver is using PDO connection to gain access to configuration from database. This driver is returningLazyConfiguration. -
Assertis\Configuration\Drivers\File\IniDriver: configuration provided from.inifile -
Assertis\Configuration\Drivers\File\JsonDriver: configuration provided from.jsonfile -
Assertis\Configuration\Drivers\File\PhpDriver: configuration provided from.phpfile. File should return array -
Assertis\Configuration\Drivers\File\YmlDriver: configuration provided from.ymlfile. File should return array -
Assertis\Configuration\Drivers\File\XmlDriver: configuration provided from.xmlfile. File should return array with configuration. Ex: ` We are returning configuration in 2 type of objects: -
Assertis\Configuration\Collection\ConfigurationArrayis array type object with some extra methods. More detail below. Assertis\Configuration\Collection\LazyConfigurationis simple array type object but with many limitations. Basically you can only usegetmethod, others will throwException.
Library is also providing Assertis\Configuration\ConfigurationFactory to create configuration easily.
Extras
-
Configuration will load "common" file if exists. File extension depends of driver type. If we are using
IniDriverfor test env thencommon.iniwill be loaded if exists. -
Environment is read from
$_SERVER['ENV']orgetenv('ENV') -
When environment is default (dev) or test, configuration structure will be tested
-
You can get value using path, for example:
rdis.db.user -
When you are asking for key when value is array, this value will be changed to
Assertis\Configuration\Collection\ConfigurationArray - You can add easily extra drivers
Installation
To install this library add the following to your composer.json file and run composer update:
Usage
To use this library add the following to your Silex application:
Add new tenant to configuration
1) First of all your service should have something called tenant schema.
2) Put your regular tenant body into config/schema/tenant.json
e.g.
3) Now in your service you should be able to add tenant to specific config file
If tenantSchemaFile is in different localization than config/schema/tenant.json please provide it as a last parameter.
E.g. of usage
All versions of config-lib with dependencies
pimple/pimple Version ^3.0
monolog/monolog Version ^1.17
symfony/validator Version ^3.0
symfony/yaml Version ^2.8 | ^3.0
ext-json Version *