承接 vi-kon/laravel-db-config 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

vi-kon/laravel-db-config

最新稳定版本:v1.2.0

Composer 安装命令:

composer require vi-kon/laravel-db-config

包简介

Laravel 5 database configurator

README 文档

README

This is Laravel 5 package for storing dynamic config in database.

Table of content

Back to top

Features

  • Dynamic config stored in database
  • Easily add new keys

Back to top

Installation

Via composer run following command in your project root:

composer require vi-kon/laravel-db-config

In your Laravel 5 project add following lines to app.php:

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

To install database migration file simple call following commands:

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.

Back to top

Usage

Getting values

Getting data from database is simple:

$value = config_db('key');

Provide default value if key not exists in database

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

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

// 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.

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.

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

Back to top

License

This package is licensed under the MIT License

Back to top

统计信息

  • 总下载量: 864
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 7
  • 点击次数: 2
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 7
  • Watchers: 1
  • Forks: 4
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2014-11-09