solomon-ochepa/laravel-settings
Composer 安装命令:
composer require solomon-ochepa/laravel-settings
包简介
Store settings as key-value pairs in the database.
关键字:
README 文档
README
Store settings as key-value pairs in the database.
All the settings saved in the database are cached to improve performance by reducing SQL queries to zero.
Installation
You can install the package via composer:
composer require solomon-ochepa/laravel-settings
Laravel 5.4
If you are installing on Laravel 5.4 or lower, you will need to manually register the Service Provider by adding it to the providers array and the Facade to the aliases array in config/app.php.
'providers' => [ //... SolomonOchepa\Settings\SettingsServiceProvider::class ] 'aliases' => [ //... "Settings" => SolomonOchepa\Settings\Facades\Settings::class ]
In Laravel 5.5 or above, the service provider automatically gets registered, and the Settings facade will be available immediately.
Get started with Settings::all().
Migration
Optionally, you can publish the migration file by running:
php artisan vendor:publish --provider="SolomonOchepa\Settings\SettingsServiceProvider" --tag="migrations"
Now, run php artisan migrate to migrate the settings table.
Getting Started
You can utilize the Laravel settings package using either the helper function settings() or the facade Settings::all().
Methods
all()
-- Pass true to ignore cached settings
settings(); // or settings()->all($fresh = false); // or Settings::all($fresh = false);
get()
Get a specific setting
settings($key, $default = null); // or settings()->get($key, $default = null); // or Settings::get($key, $default = null);
my()
Get the auth() user settings.
settings()->my($key, $default = null); // or Settings::my($key, $default = null);
set()
Set a specific setting
settings([$key => $value]); // or settings()->set($key, $value); // or Settings::set($key, $value);
// Set a multiple settings
settings([$key => $value, $key2 => $value2]); // or settings()->set([ $key => $value, $key2 => $value2, ]); // or Settings::set([ $key => $value, $key2 => $value2, ]);
has()
Check if a setting key exists
settings()->has($key); // or Settings::has($key);
remove()
Remove a setting
settings()->remove($key); // or Settings::remove($key);
Groups
You can organize your settings into groups.
If you are upgrading from a previous version, don't forget to run the migration.
Initiate grouping by chaining the group() method:
// Save setting settings([$key => $value])->group($name); // Get setting settings($key)->group($name);
Settable for()
Get/set settings for a specific entity
Settings::for($settable)->set($key, $value) // helper function settings()->for($settable)->set($key, $value) // Example: settings()->for(auth()->user())->set($key, $value);
Settable user()
Bind settings to the auth user.
settings()->user()->all();
Changelog
Please see CHANGELOG for more information on what has changed recently.
Testing
The package contains some integration/smoke tests, set up with Orchestra. The tests can be run via phpunit.
$ composer test
Contributing
Please see CONTRIBUTING for details.
Security
If you discover any security-related issues, please email solomonochepa@gmail.com instead of using the issue tracker.
Credits
- ...
About "Oki Technologies Ltd"
Oki Technologies, https://www.okitechnologies.com.ng is a dynamic IT firm dedicated to delivering cutting-edge solutions in software development and related services. With a passion for innovation and a commitment to excellence, Oki Technologies leverages the latest technologies and industry best practices to craft tailored solutions that meet the unique needs of each client.
From web and mobile application development to custom software solutions, Oki Technologies offers a comprehensive suite of services designed to empower businesses and organizations across various industries. With a team of skilled professionals, Oki Technologies combines technical expertise with creative insights to deliver high-quality, scalable, and user-friendly software solutions.
At Oki Technologies, we prioritize customer satisfaction and strive to build long-term partnerships with our clients. Our collaborative approach ensures that we understand our clients' goals and objectives, allowing us to deliver solutions that drive tangible results and add value to their businesses.
Whether you're a startup looking to launch a digital product or an established enterprise seeking to optimize your existing software infrastructure, Oki Technologies is your trusted partner for all your software development needs. Let us help you turn your ideas into reality and propel your business to new heights in the digital age.
License
The MIT License (MIT). Please see License File for more information.
solomon-ochepa/laravel-settings 适用场景与选型建议
solomon-ochepa/laravel-settings 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 9.62k 次下载、GitHub Stars 达 2, 最近一次更新时间为 2024 年 05 月 29 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「laravel」 「Settings」 「eloquent」 「laravel-settings」 「solomon-ochepa」 「laravel-user-settings」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 solomon-ochepa/laravel-settings 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 solomon-ochepa/laravel-settings 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 solomon-ochepa/laravel-settings 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Persistent settings package for Laravel framework.
A Laravel Eloquent model trait for translatable resource
A Zend Framework module to quickly and easily set PHP settings.
A package for automatically encrypting and decrypting Eloquent attributes in Laravel 5.5+, based on configuration settings.
Settings Card for Laravel Nova.
Help to manage meta data on Laravel Eloquent model
统计信息
- 总下载量: 9.62k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 3
- 点击次数: 16
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-05-29