LaravelPackages.net
Acme Inc.
Toggle sidebar
cupoftea/easycfg

Easily add configuration data to your Eloquent Models or Application in Laravel 5!

25
0
v1.1.2
About cupoftea/easycfg

cupoftea/easycfg is a Laravel package for easily add configuration data to your eloquent models or application in laravel 5!. It currently has 0 GitHub stars and 25 downloads on Packagist (latest version v1.1.2). Install it with composer require cupoftea/easycfg. Discover more Laravel packages by cupoftea or browse all Laravel packages to compare alternatives.

Last updated

Latest Stable Version Total Downloads Latest Unstable Version StyleCI License

EasyCFG

Easily add configuration data to your Eloquent Models or Application in Laravel 5!

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.

Quickstart

$ 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>

Features

  • Simple access to Configuration Data via the Facade or Helper function.
  • Trait to ease setting data on Models or any other Class.
  • Configurable database table.
  • @cfg Blade directive.

Star History Chart