Skip to content

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

License

Notifications You must be signed in to change notification settings

elusivecodes/FyreConfig

Repository files navigation

FyreConfig

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;

Basic Usage

$config = new Config();

Autoloading

It is recommended to bind the Config to the Container as a singleton.

$container->singleton(Config::class);

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.
$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.
$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);

About

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

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages