定制 nhwin/settings 二次开发

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

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

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

Run Tests Code Style License

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

  1. Install the package via Composer:

    composer require nhwin/settings
  2. 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"
    
  3. Run the migration:

    php artisan migrate

    This command executes the migration file that you just published, creating the settings table (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:

  1. 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.

  1. 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.

  1. Save and Edit Settings from the Admin Panel

    You can now edit these settings directly in your Filament admin panel—no extra boilerplate needed.

  2. 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 我们能提供哪些服务?
定制开发 / 二次开发

基于 nhwin/settings 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-09-29