定制 vaslv/laravel-settings 二次开发

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

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

vaslv/laravel-settings

最新稳定版本:1.1.0

Composer 安装命令:

composer require vaslv/laravel-settings

包简介

Reusable Laravel settings package with typed values and caching.

README 文档

README

Reusable Laravel package for storing typed settings in the database with caching and a clean API.

Requirements

  • PHP 8.2+
  • Laravel 10-13

Laravel 13 requires PHP 8.3+ because the underlying illuminate/* 13.x components require it.

Installation

composer require vaslv/laravel-settings

Publish the config and migration:

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

Run migrations:

php artisan migrate

Configuration

config/settings.php

return [
    'table' => 'settings',
    'encryption' => [
        'enabled' => false,
    ],
    'cache' => [
        'enabled' => true,
        'ttl' => 3600,
        'key' => 'settings',
    ],
];

If you change table, the published migration will use the configured name.

Usage

Facade

use Settings;

Settings::get('site.legal_text');
Settings::set('site.enabled', true);
Settings::set('site.legal_text', '# Legal', 'markdown');
Settings::set('legal_text', '# Legal'); // group = null

Helper

setting('site.legal_text');
setting('site.enabled', false);
setting('site.legal_text', '# Legal', 'markdown');
setting()->groups();

Supported Types

  • string
  • boolean
  • integer
  • float
  • html
  • json
  • markdown

Types are stored explicitly in the DB and cast on read.

Cache

The package caches all settings under one key and clears it automatically on set.

Encryption

Enable encryption to store raw values in encrypted form in the database. Values are decrypted on read.

return [
    'encryption' => [
        'enabled' => true,
    ],
];

Code Style

Code is formatted to comply with Laravel Pint.

Compatibility

The package is tested against these combinations:

  • Laravel 10 on PHP 8.2
  • Laravel 11 on PHP 8.2
  • Laravel 12 on PHP 8.2
  • Laravel 13 on PHP 8.3

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-02-16

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固