2017 © Pedro PelĂĄez
 

library laravel-db-config

Laravel 5 database configurator

image

vi-kon/laravel-db-config

Laravel 5 database configurator

  • Tuesday, May 10, 2016
  • by vincekovacs
  • Repository
  • 1 Watchers
  • 7 Stars
  • 700 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 4 Forks
  • 3 Open issues
  • 5 Versions
  • 14 % Grown

The README.md

Laravel 5 database config

This is Laravel 5 package for storing dynamic config in database., (*1)

Table of content, (*2)


Back to top, (*3)

Features

  • Dynamic config stored in database
  • Easily add new keys

Back to top, (*4)

Installation

Via composer run following command in your project root:, (*5)

composer require vi-kon/laravel-db-config

In your Laravel 5 project add following lines to app.php:, (*6)

// to app.php's providers array
'ViKon\DbConfig\DbConfigServiceProvider',

To install database migration file simple call following commands:, (*7)

php artisan vendor:publish --provider=ViKon\DbConfig\DbConfigServiceProvider

php artisan migrate

This will install create_config_table migration file to application database/migrations directory and create new config table in default database., (*8)


Back to top, (*9)

Usage

Getting values

Getting data from database is simple:, (*10)

$value = config_db('key');

Provide default value if key not exists in database, (*11)

$value = config_db('key', 'default_value');

If no parameter provided to config_db function, then it returns ViKon\DbConfig\DbConfig instance., (*12)

// Get value by key
$value = config_db()->get('key');

// Get value by key with default value
$value = config_db()->get('key', 'default_value');

Set values

Set values to database is easy simple call config_db function with no parameter and after it call set method., (*13)

config_db()->set('key', 'value');

Organize config keys

For better maintenance there is a support organizing config values to groups. To get or set config value to group simple use {group}::{key} schema as key., (*14)

// Gets 'db' group username value 
$value = config_db('db::username');

Back to top, (*15)

License

This package is licensed under the MIT License, (*16)


Back to top, (*17)

The Versions

10/05 2016

dev-master

9999999-dev https://github.com/vi-kon/laravel-db-config

Laravel 5 database configurator

  Sources   Download

MIT

The Requires

 

by KovĂĄcs Vince

database laravel config

10/05 2016

v1.2.0

1.2.0.0 https://github.com/vi-kon/laravel-db-config

Laravel 5 database configurator

  Sources   Download

MIT

The Requires

 

by KovĂĄcs Vince

database laravel config

10/05 2016

dev-develop

dev-develop https://github.com/vi-kon/laravel-db-config

Laravel 5 database configurator

  Sources   Download

MIT

The Requires

 

by KovĂĄcs Vince

database laravel config

03/05 2016

v1.1.0

1.1.0.0 https://github.com/vi-kon/laravel-db-config

Laravel 5 database configurator

  Sources   Download

MIT

The Requires

 

by KovĂĄcs Vince

database laravel config

10/03 2015

v1.0.0

1.0.0.0 https://github.com/vi-kon/laravel-db-config

Laravel 5 database configurator

  Sources   Download

MIT

The Requires

 

by KovĂĄcs Vince

database laravel config