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

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

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

alisaleem/laravel-settings

最新稳定版本:v1.2.2

Composer 安装命令:

composer require alisaleem/laravel-settings

包简介

File based configurable settings for laravel applications

README 文档

README

Latest Version on Packagist Total Downloads

Store your application settings in any of your applications storage filesystems. The schema for the settings is defined by a normal PHP class and all primitive types are supported. This also provides IDE type hints when reading to writing settings.

Updated values are written to the filesystem on destruct.

Installation

You can install the package via composer:

composer require alisaleem/laravel-settings

Create your own Settings class and extend the abstract Settings class from this package

namespace App;

class MySettings extends \AliSaleem\LaravelSettings\BaseSettings
{
    public string $key;
    public string $anotherKey = 'Default Value';
}

Optionally add the helper function. This will also provide IDE type-hinting

if (! function_exists('settings')) {
    function settings(): \App\MySettings
    {
        return resolve(config('settings.class'));
    }
}

You can publish the config file with:

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

Set the class and storage location in the config file

return [
    'class' => \App\MySettings::class,

    'storage' => [
        'disk' => null,
        'path' => 'settings.json',
    ],
];

Usage

// To retrieve a value
$value = resolve(\App\MySettings::class)->key;
$value = settings()->anotherKey;

// To set a value
resolve(\App\MySettings::class)->key = 'changed';
settings()->anotherKey = 'changed';

Testing

composer test

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.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-03-08

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固