nhwin/settings
Composer 安装命令:
composer require nhwin/settings
包简介
A Filament plugin for database-backed application settings and editable content, with caching and easy page generation.
README 文档
README
Requirements
- PHP version supported by your Laravel installation
- Laravel 12
- A database engine with JSON support (MySQL 5.7+, MariaDB 10.2.7+, PostgreSQL, SQLite recent versions)
- Filament 4
- PHP ^8.2
Installation
-
Install the package via Composer:
composer require nhwin/settings
-
Publish the assets (Configuration and Migration):
<!-- Publish Configuration --> php artisan vendor:publish --tag=settings-config <!-- Publish Migrations --> php artisan vendor:publish --tag=settings-migrations <!-- Publish Lang --> php artisan vendor:publish --tag=settings-translations <!-- or --> php artisan vendor:publish --provider="Nhwin\Settings\Providers\SettingServiceProvider"
-
Run the migration:
php artisan migrate
This command executes the migration file that you just published, creating the
settingstable (or the custom table name you defined in the config file) in your database. Your package is now ready to use!
Tip
If you want to use a custom table name instead of settings, edit the configuration file config/settings.php before running the migration. See the Configuration section for details.
🚀 Getting Started
Get up and running in just a few steps:
-
Generate Your First Settings Page
php artisan make:settings Website
This command creates a new Filament page (e.g., App/Filament/Pages/WebsiteSettings.php). You can repeat this step for more pages as needed.
Note
The generator will automatically add the “Settings” suffix to the page name for consistency (e.g., WebsiteSettings), but you can use any group name you wish.
-
Define Your Fields
Open the generated page and customize the form() method with your desired fields:
public function form(Form $form): Form { return $form ->components([ TextInput::make('site_name')->label('Site Name'), TextInput::make('contact_email')->label('Contact Email'), Toggle::make('maintenance_mode')->label('Maintenance Mode'), ]) ->statePath('data'); }
Note
You may use any Filament form fields or layout components - including third-party ones - to build your settings and content pages, giving you full flexibility in how data is structured and edited.
-
Save and Edit Settings from the Admin Panel
You can now edit these settings directly in your Filament admin panel—no extra boilerplate needed.
-
Use Your Settings Anywhere
Retrieve your configuration values easily:
-
In PHP:
$siteName = settings('website.site_name', 'Default Site Name');
-
In Blade:
<h1>{{ settings('website.site_name', 'Default Site Name') }}</h1> <!-- or --> <h1>@settings('website.site_name', 'Default Site Name')</h1>
-
That’s it! 🎉
Define your fields, save from the admin panel, and access your settings anywhere in your Laravel app.
nhwin/settings 适用场景与选型建议
nhwin/settings 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 7 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 09 月 29 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「laravel」 「filament」 「laravel-filament」 「filament-plugin」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 nhwin/settings 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 nhwin/settings 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 nhwin/settings 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Change the default avatar url provider with one for inline SVGs
Spotlight for Filament Admin
A Filament plugin for database-backed application settings and editable content, with caching and easy page generation.
Filament Password Confirmation
Alfabank REST API integration
Spotlight for Filament Admin
统计信息
- 总下载量: 7
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 9
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-09-29