Download the PHP package davidlienhard/config without Composer
On this page you can find all versions of the php package davidlienhard/config. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download davidlienhard/config
More information about davidlienhard/config
Files in davidlienhard/config
Package config
Short Description 🐘 php library to get configuration data from json files
License MIT
Homepage https://github.com/davidlienhard/config/
Informations about the package config
davidlienhard/config
🐘 php library to get configuration data from json/yaml files
Setup
You can install through composer with:
Note: davidlienhard/config requires PHP 8.0
Examples
Setup
Read Data
Example Config File: system.json
get single value
get single value with a specific type
the following methods do exists
getAsString()getAsInt()getAsFloat()getAsBool()getAsArray()
get associative array
get numeric array
get not existing value
get data from not existing file
Parsers / Supported Filetypes
By default, this library contains two parsers. One for Json & one for Yaml/Yml files.
If required it is possible to add a customer parser for othe filetypes, i.e. XML or INI.
The custom parser must extend the class ParserAbstract and implement the Interface ParserInterface.
A parser can be registered as follows:
Exceptions
The library currently contains the following exceptions
Config- Main Exception that is parent of all other exceptionsConversion- Errors that happen during type conversion. eg trying to convert a string to an arrayMismatch- Trying to access configuration data that is not availableFileMismatch- Trying to access a file that does not existParser- errors that happen when parsing files. usually through invalid filesKeyMismatch- Trying to access a key that does not exists, while the file is present
License
The MIT License (MIT). Please see LICENSE for more information.
All versions of config with dependencies
ext-json Version ^8.4
davidlienhard/functioncaller Version ^1
league/flysystem Version ^3
symfony/yaml Version ^7
nette/neon Version ^3
davidlienhard/convert Version ^1