承接 ryangjchandler/laravel-json-settings 相关项目开发

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

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

ryangjchandler/laravel-json-settings

最新稳定版本:v0.1.0

Composer 安装命令:

composer require ryangjchandler/laravel-json-settings

包简介

Store your Laravel application settings in an on-disk JSON file.

README 文档

README

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

This package provides a simple SettingsRepository class that can be used to store your application's settings in a single JSON file.

Installation

You can install the package via composer:

composer require ryangjchandler/laravel-json-settings

You can publish the config file with:

php artisan vendor:publish --tag="json-settings-config"

Usage

You can resolve an instance of RyanChandler\LaravelJsonSettings\SettingsRepository from the container by type-hinting it in any DI-supported method, e.g. a controller method.

class IndexController
{
    public function __invoke(SettingsRepository $settings)
    {
        return view('index', [
            'title' => $settings->get('index.title'),
        ]);
    }
}

The SettingsRepository class contains the following methods:

  • get(string $key, mixed $default = null) - retrieve the value of a setting by providing the key (dot-notation supported).
  • set(string $key, mixed $value, bool $save = true) - set the value of a setting and toggle auto-save.
  • has(string $key) - determine if a setting exists.
  • save() - manually save your settings back to disk.
  • reload() - clear the cache and reload the settings from disk.

If you prefer to use facades, you can interact with the RyanChandler\LaravelJsonSettings\Facades\Settings facade directly too.

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

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

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-02-14