2017 © Pedro Peláez
 

library laravel-conf

Store additional configs in JSON or Database (write, read)

image

gaaarfild/laravel-conf

Store additional configs in JSON or Database (write, read)

  • Monday, November 14, 2016
  • by garf
  • Repository
  • 2 Watchers
  • 22 Stars
  • 790 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 2 Forks
  • 0 Open issues
  • 15 Versions
  • 6 % Grown

The README.md

Laravel Improved Config

Software License Laravel Version, (*1)

Laravel Conf, (*2)

Russian Documentation / Русская документация, (*3)

Custom editable configs for Laravel 5., (*4)

Caution

Repository address changed from gaaarfild to garf. Dont forget to fix your composer.json., (*5)

This package helps you to store your additional configuration from your code in custom storage., (*6)

By default it uses JSON-file., (*7)

This is helpful when you need to edit your configuration by user from GUI. i.e. Website settings., (*8)

Caution!

Be careful! This is version 2 of the package and fallback configuration was removed., (*9)

If you still need to use it, please install version 1.*, (*10)

Install

To install version 2, type the following command in your command line:, (*11)

``` BASH $ composer require "garf/laravel-conf:3.*", (*12)


Or add ``` JSON "garf/laravel-conf": "3.*"

to your composer.json file into require section., (*13)

Then type in console, (*14)

``` BASH $ composer update, (*15)


When update completed, add to your `config/app.conf` file to `providers` section ``` PHP 'providers' => [ // ... Garf\LaravelConf\LaravelConfServiceProvider::class, ]

If you want to use Conf facade, add to same file at the aliases section, (*16)

``` PHP 'aliases' => [ // ... 'Conf' => Garf\LaravelConf\ConfFacade::class, ], (*17)


### Publishing config file To be able to change file location, please execute the following command in the console: `php artisan vendor:publish --provider="Garf\LaravelConf\LaravelConfServiceProvider" --tag="config"` Then you can edit file `config/laravel-conf.php` to set any path to file you want to. ## Usage ### Get config value ``` php Conf::get('key.to.retrieve', 'default_value');

Else will return default value., (*18)

Could be used 'dot' notation, (*19)

Save config value

``` PHP Conf::set('key', 'value_to_save');, (*20)


Could be used 'dot' notation Also method `put` can be used to store multiple config values as array ``` PHP $config = [ 'key1' => 'value1', 'key2.subkey' => `value2`, ]; Conf::put($config);

Removing key from config

``` PHP Conf::forget('key');, (*21)


Could be used 'dot' notation ### Get entire config ``` PHP Conf::all();

Get entire config in JSON

``` PHP Conf::toJson();, (*22)


### Check config key existence ``` PHP Conf::has('key.to.check');

Could be used 'dot' notation, (*23)

Helper

Also helper conf() can be used for more convenience., (*24)

Usage is similar to build in config() helper., (*25)

``` PHP conf()->set('key.subkey', 'myValue');, (*26)

conf('key.subkey') // will return 'myValue', (*27)

conf('non.existing.key', 'myDefaultValue') // will return 'myDefaultValue', (*28)

$config = [ 'key1' => 'value1', 'key2.subkey' => value2, ];, (*29)

conf($config), (*30)


## Custom storage drivers This package uses the Laravel Manager class under the hood, so it's easy to add your own custom store driver if you want to store in some other way. All you need to do is extend the abstract `Garf\LaravelConf\Drivers\AbstractDriver` class, implement the abstract methods and call Conf::extend. ``` php class MyStorageDriver extends Garf\LaravelConf\Drivers\AbstractDriver { // ... } Conf::extend('mystorage', function($app) { return $app->make('MyStorageDriver'); });

Contributions

Contributions are highly appreciated., (*31)

Send your pull requests to master branch., (*32)

License

The MIT License (MIT). Please see License File for more information., (*33)

The Versions

14/11 2016

dev-master

9999999-dev

Store additional configs in JSON or Database (write, read)

  Sources   Download

MIT

The Requires

 

by Dinar Garipov

laravel json config

14/11 2016

v3.0.3

3.0.3.0

Store additional configs in JSON or Database (write, read)

  Sources   Download

MIT

The Requires

 

by Dinar Garipov

laravel json config

27/09 2016

v3.0.2

3.0.2.0

Store additional configs in JSON or Database (write, read)

  Sources   Download

MIT

The Requires

 

by Dinar Garipov

laravel json config

27/09 2016

v3.0.1

3.0.1.0

Store additional configs in JSON or Database (write, read)

  Sources   Download

MIT

The Requires

 

by Dinar Garipov

laravel json config

17/07 2016

v3.0.0

3.0.0.0

Store additional configs in JSON or Database (write, read)

  Sources   Download

MIT

The Requires

 

by Dinar Garipov

laravel json config

27/06 2016

v2.0.2

2.0.2.0

Store additional configs in JSON (write, read)

  Sources   Download

MIT

The Requires

 

by Dinar Garipov

laravel config

27/06 2016

V2.0.1

2.0.1.0

Store additional configs in JSON (write, read)

  Sources   Download

MIT

The Requires

 

by Dinar Garipov

laravel config

27/06 2016

v2.0.0

2.0.0.0

Store additional configs in JSON (write, read)

  Sources   Download

MIT

The Requires

 

by Dinar Garipov

laravel config

26/06 2016

v1.2.2

1.2.2.0

Store additional configs in JSON (write, read)

  Sources   Download

MIT

The Requires

 

by Dinar Garipov

laravel config

20/06 2016

v1.2.1

1.2.1.0

Store additional configs in JSON (write, read)

  Sources   Download

MIT

The Requires

 

by Dinar Garipov

laravel config

16/04 2016

v1.2.0

1.2.0.0

Store additional configs in JSON (write, read)

  Sources   Download

MIT

The Requires

 

by Dinar Garipov

laravel config

16/04 2016

dev-analysis-8QMkoO

dev-analysis-8QMkoO

Store additional configs in JSON (write, read)

  Sources   Download

MIT

The Requires

 

by Dinar Garipov

laravel config

25/12 2015

v1.1.0

1.1.0.0

Store additional configs in JSON (write, read)

  Sources   Download

MIT

The Requires

 

by Dinar Garipov

laravel config

21/09 2015

dev-analysis-q1N1yz

dev-analysis-q1N1yz

Store additional configs in JSON (write, read)

  Sources   Download

MIT

The Requires

 

by Dinar Garipov

laravel config

27/08 2015

v1.0.0

1.0.0.0

Store additional configs in JSON (write, read)

  Sources   Download

MIT

The Requires

 

by Dinar Garipov

laravel config