Download the PHP package tobento/service-config without Composer
On this page you can find all versions of the php package tobento/service-config. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download tobento/service-config
More information about tobento/service-config
Files in tobento/service-config
Package service-config
Short Description Loading and managing configuration data for PHP applications.
License MIT
Homepage https://www.tobento.ch
Informations about the package service-config
Config Service
The Config Service provides a way for managing configuration data in an application.
Table of Contents
- Getting started
- Requirements
- Highlights
- Simple Example
- Documentation
- Create Config
- Set Data
- Load Data
- PHP Loader
- JSON Loader
- Get Data
- Has Data
- Translations
- Credits
Getting started
Add the latest version of the config service running this command.
Requirements
- PHP 8.0 or greater
Highlights
- Framework-agnostic, will work with any project
- Decoupled design
- Translation support
Simple Example
Here is a simple example of how to use the config service:
Documentation
Create Config
Set Data
By dot notation
You might set or add new data by using dot notation:
Load Data
You might use loaders to load data from files.
PHP Loader
The php loader, loads data from php files returning an array of data.
database.php config file
Only loading data
You may omit the key: to load data without storing.
JSON Loader
The json loader, loads data from json files.
Get Data
Default Value
You might set a default value to return if the data requested doesn't exist, otherwise a ConfigNotFoundException is thrown.
A note on default value and data type
You can use the default value to ensure the right data type is returned.
Has Data
Translations
You might want to load, set and get translated config data.
Create Config
You might configure the translations based your needs. For more info visit Collection Service - Translations
Set Data
Load Data
Get Data
Credits
- Tobias Strub
- All Contributors
All versions of service-config with dependencies
tobento/service-collection Version ^1.0
tobento/service-filesystem Version ^1.0.5
tobento/service-dir Version ^1.0