定制 samaphp/laravel-key-value 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

samaphp/laravel-key-value

最新稳定版本:0.0.1

Composer 安装命令:

composer require samaphp/laravel-key-value

包简介

Key/value store collection for Laravel

README 文档

README

Use samaphp/laravel-key-value to store key value pair settings in the database. The database table has three fields only. (collection, key, value).

Installation

  1. Require the package: composer require samaphp/laravel-key-value
  2. You can directly start using it, please refer to usage examples section below.

Usage

// The alias already defined but you can use the service from this path
use Samaphp\LaravelKeyValue\LaravelKeyValue;
// system.stats is a collection name. (aka variables group name)
$keyValue = new LaravelKeyValue('system.stats');
$keyValue->set('last_success_sms', time());
print $keyValue->get('last_success_sms', 'DEFAULT_VALUE_HERE');

// Print all variables from the targeted collection (system.stats)
print_r($keyValue->all());

// Delete a specific variable
$keyValue->delete('last_success_sms');

// Shortcut
print (new LaravelKeyValue('system.stats'))->get('last_success_sms');

// You can save an array, which will be encoded in JSON to be saved into the database
$value = ['hi', 'hello'];
$keyValue->set('test', $value);

// Will be decoded and returned as an array
dd($keyValue->set('test'));

Alternatives

This package was inspired by laravel-settings package by Mohd Saqueib Ansari, but made to be simple and straightforward solution to provide a key/value store functionality. If you are looking for alternatives, you can consider laravel-settings package.

Security

If you discover any security related issues, please open a new issue using the issue tracker.

License

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

统计信息

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

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-07-15

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固