fyre/config

A configuration library.

v3.0.6 2024-06-29 06:26 UTC

This package is auto-updated.

Last update: 2024-08-29 06:53:13 UTC


README

FyreConfig is a free, open-source configuration library for PHP.

Table Of Contents

Installation

Using Composer

composer require fyre/config

In PHP:

use Fyre\Config\Config;

Methods

Add Path

Add a config path.

  • $path is the path to add.
  • $prepend is a boolean indicating whether to prepend the file path, and will default to false.
Config::addPath($path, $prepend);

Clear

Clear config data.

Config::clear();

Consume

Retrieve and delete a value from the config using "dot" notation.

  • $key is the key to lookup.
  • $default is the default value to return, and will default to null.
$value = Config::consume($key, $default);

Delete

Delete a value from the config using "dot" notation.

  • $key is the key to remove.
$deleted = Config::delete($key);

Get

Retrieve a value from the config using "dot" notation.

  • $key is the key to lookup.
  • $default is the default value to return, and will default to null.
$value = Config::get($key, $default);

Get Paths

Get the paths.

$paths = Config::getPaths();

Has

Determine if a value exists in the config.

  • $key is the key to check for.
$has = Config::has($key);

Load

Load a file into the config.

  • $file is a string representing the config file.
Config::load($file);

Remove Path

Remove a path.

  • $path is the path to remove.
$removed = Config::removePath($path);

Set

Set a config value using "dot" notation.

  • $key is the key.
  • $value is the value to set.
  • $overwrite is a boolean indicating whether previous values will be overwritten, and will default to true.
Config::set($key, $value, $overwrite);