Download the PHP package xeriab/konfig without Composer
On this page you can find all versions of the php package xeriab/konfig. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download xeriab/konfig
More information about xeriab/konfig
Files in xeriab/konfig
Package konfig
Short Description Yet another simple configuration loader library.
License MIT
Homepage http://xeriab.github.io/projects/konfig/
Informations about the package konfig
Konfig
Yet another simple configuration loader library.
Konfig is a simple configuration loader library that supports INI
, JSON
, NEON
, PHP
, TOML
, XML
, Java-Properties
and YML/YAML
files.
REQUIREMENTS
Konfig requires PHP 5.6+
and suggests using Yosymfony Toml Parser, Nette NEON and PHP YAML or Symfony YAML.
INSTALLATION
The supported way of installing Konfig is via Composer.
USAGE
Konfig is designed with simplicity in mind and it is lightweight and straightforward to use. All you can do with it is load, get, set and delete.
LOADING FILES
The Konfig
object can be created via the factory method load()
, or
by direct instantiation:
Files are parsed and loaded depending on the file extension.
NOTE: When loading multiple files, entries with duplicate keys will take on the value from the last loaded file.
NOTE: 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 Konfig 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 Konfig for storing
application settings, without needing file I/O. You can do this by extending
the AbstractKonfig
class and populating the getDefaults()
method:
EXAMPLES OF SUPPORTED CONFIGURATION FILES
Examples of simple, valid configuration files can be found here.
CHANGELOG
Please see CHANGELOG for details.
TESTING
CONTRIBUTING
Please see CONTRIBUTING for details.
CREDITS
CONTRIBUTORS
LICENSE
The MIT License (MIT). Please see License for more information.