dannykopping / fig
Dead-simple configurations
Installs: 1 325
Dependents: 0
Suggesters: 0
Security: 0
Stars: 3
Watchers: 2
Forks: 0
Open Issues: 0
Requires
- php: >=5.3
This package is not auto-updated.
Last update: 2024-12-21 16:10:16 UTC
README
Fig - Dead-simple configurations
Using Fig
is stupidly easy. Install with Composer:
{
"require": {
"dannykopping/fig": "dev-master"
}
}
To initialize a set of configuration options:
use Fig\Fig; require_once "vendor/autoload.php"; Fig::setUp(array( "name" => "Fig", "multiple" => array( "levels" => array( "of" => "nesting goodness" ) ) ) );
To access your configuration options, either use simple strings for top-level keys:
echo Fig::get("name"); // prints "Fig"
...or use dot-notation to indicate hierarchy:
echo Fig::get("multiple.levels.of"); // prints "nesting goodness"
Oh - you want to set values, too?
Fig::set("year", 2013); echo Fig::get("year"); // prints "2013" (and maintains your data types)
...even multi-level values!
Fig::set("calendar.years", array(2010,2011,2012,2013)); echo implode(", ", Fig::get("calendar.years")); // prints "2010, 2011, 2012, 2013"
Wanna get rid of a bad fig?
Fig::delete("year"); echo Fig::get("year"); // prints null, key is removed
All your figs?
print_r(Fig::getAll());