Package Data | |
---|---|
Maintainer Username: | CupOfTea696 |
Maintainer Contact: | cupoftea696@gmail.com (CupOfTea696) |
Package Create Date: | 2015-06-06 |
Package Last Update: | 2015-11-05 |
Home Page: | http://easycfg.cupoftea.io/ |
Language: | PHP |
License: | MIT |
Last Refreshed: | 2024-12-14 15:16:30 |
Package Statistics | |
---|---|
Total Downloads: | 23 |
Monthly Downloads: | 1 |
Daily Downloads: | 0 |
Total Stars: | 0 |
Total Watchers: | 2 |
Total Forks: | 0 |
Total Open Issues: | 0 |
EasyCFG is a Configuration Manager for Laravel 5. It provides an easy way to save Configuration and other Metadata.
With EasyCfg, saving data related to other things, wether it is on your Application, a Class or an Object, becomes a simple task. Some use cases are User Settings and dynamic Application Configuration (e.g. in an Admin Panel), but of course you can use this however you like.
$ composer require cupoftea/easycfg ^1.1
// Global data
Cfg::set('key', 'value');
$value = Cfg::get('key');
// Class data
cfg()->set('key', 'value', MyConfigurableCommand::class);
$value = cfg('key', MyConfigurableCommand::class);
// Object data (Class instance)
// where $myobject = {"id": 1, "property": "value"}
cfg()->set('key', 'value', $myObject);
cfg()->set('foo', 'bar', MyConfigurableClass::class, $myObject->id);
$cfg = cfg()->all($myObject);
// Settings in Blade partials
// app.blade.php
<div class="content @cfg('scheme')-scheme">
@yield('content')
</div>
// page.blade.php
@cfg('scheme', 'dark')
@section('content')
...
@endsection
// Rendered HTML
<div class="content dark-scheme">
...
</div>