Download the PHP package matiasnamendola/slimpower-config without Composer
On this page you can find all versions of the php package matiasnamendola/slimpower-config. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download matiasnamendola/slimpower-config
More information about matiasnamendola/slimpower-config
Files in matiasnamendola/slimpower-config
Package slimpower-config
Short Description Config is a file configuration loader that supports PHP, INI, XML, JSON, and YML files.
License MIT
Homepage https://github.com/matiasnamendola/slimpower-config
Informations about the package slimpower-config
SlimPower - Config
Config is a file configuration loader that supports PHP, INI, XML, JSON, and YML files.
Installation
In terminal:
Or you can add use this as your composer.json:
Requirements
Config requires PHP 5.3+, and suggests using the Symfony Yaml component.
Config is designed to be very simple and straightforward to use. All you can do with it is load, get, and set.
Loading files
The Config
object can be created via the factory method load()
, or
by direct instantiation:
Files are parsed and loaded depending on the file extension. Note that when loading multiple files, entries with duplicate keys will take on the value from the last loaded file.
When loading a directory, the path is glob
ed and files are loaded in by
name alphabetically.
Getting values
Getting values can be done in three ways. One, by using the get()
method:
The second method, is by using it like an array:
The third method, is by using the all()
method:
Setting values
Although Config supports setting values via set()
or, via the
array syntax, any changes made this way are NOT reflected back to the
source files. By design, if you need to make changes to your
configuration files, you have to do it manually.
Using with default values
Sometimes in your own projects you may want to use Config for storing
application settings, without needing file I/O. You can do this by extending
the AbstractConfig
class and populating the getDefaults()
method:
Credits
License
The MIT License (MIT). Please see License File for more information.