thiphariel/config-file-loader

Configuration file loader in PHP

1.2.0 2018-05-18 15:43 UTC

This package is not auto-updated.

Last update: 2024-04-28 01:50:22 UTC


README

Build Status Coverage Status Downloads GitHub license

SensioLabsInsight

This library is a configuration file loader in PHP that supports JSON and PHP files at the moment.

Requierements

  • PHP >=7.1

Installation

composer require thiphariel/config-file-loader

Usage

// Create an instance of Config
$config = new Config();

// Load JSON configuration file
$config->load("config.json");

// Load PHP configuration file
$config->load("config.php");

// Getting values
$host = $config->get("host");
$port = $config->get("port");

// Nested keys
$env = $config->get("environment.dev");

Examples of configurations can be found in the tests/config folder.