syriable/filament-utilities
最新稳定版本:0.1.2
Composer 安装命令:
composer require syriable/filament-utilities
包简介
Developer tooling for the Syriable Filament ecosystem — translatable resource generators and modular plugin scaffolding.
README 文档
README
Developer tooling for the Syriable Filament ecosystem. The package wires custom Artisan generators that scaffold translatable Filament resources and module plugins, built on top of syriable/filament-translator.
Features
syriable:make-resource— drop-in replacement for Filament's resource generator that extendsTranslatableResourceand translatable resource pages instead of Filament's base classes.- Module-aware model discovery — interactive model selection searches Eloquent models under your
modules/directory. plugin:resource— scaffolds a Filament panel plugin for an InterNACHI/modular module and registers it in the module service provider.- Custom file generators — binds Syriable generators into Filament's
make:filament-resourcepipeline so generated code is translation-ready out of the box.
Requirements
- PHP 8.4+
- Laravel 12 or 13
- Filament 5.5+
syriable/filament-translator^1.1syriable/filament-activitylog^0.1
For plugin:resource, your application must use InterNACHI/modular with modules under the path configured in config/app-modules.php.
Installation
Install the package via Composer:
composer require syriable/filament-utilities
Register TranslatorPlugin on every Filament panel that should resolve convention-based labels:
use Filament\Panel; use Syriable\Filament\Plugins\Translator\TranslatorPlugin; public function panel(Panel $panel): Panel { return $panel ->plugins([ TranslatorPlugin::make(), ]); }
UtilitiesServiceProvider is auto-discovered. No panel plugin registration is required for the generators to work.
Usage
Generate a translatable resource
Use syriable:make-resource (alias: syriable:resource) instead of make:filament-resource. It accepts the same options as Filament's command — panel selection, soft deletes, separate form/table schema classes, and so on.
php artisan syriable:make-resource Buyer --panel=dashboard
When no model argument is passed, the command interactively suggests Eloquent models discovered from classes loaded from your modules/ directory.
Generated classes extend Syriable's translatable bases:
| Generated class | Extends |
|---|---|
| Resource | TranslatableResource |
| Create page | TranslatableCreateRecord |
| Edit page | TranslatableEditRecord |
| List page | TranslatableListRecords |
Model namespaces are resolved relative to the selected resource namespace so module resources reference module models instead of App\Models.
After generation, add translation keys under lang/{locale}/ following the filament-translator convention. Enable createMissingTranslationKeys() during local development to scaffold missing keys automatically.
Generate a module Filament plugin
Scaffold a Filament plugin class inside a modular application:
php artisan plugin:resource users
When the module name is omitted, the command interactively lists directories under modules/.
The command:
- Creates
{Module}Plugin.phpinmodules/{module}/src/using the published stub. - Registers the plugin on the module's service provider via
Panel::configureUsing().
The generated plugin discovers resources, pages, and widgets under the module's Filament/ directories.
Publish generator stubs
Customize the plugin stub before running plugin:resource:
php artisan vendor:publish --tag=filament-utilities-stubs
Stubs are copied to stubs/filament-utilities/ in your application root.
Opinionated Filament defaults and macros
The package ships several opt-in helpers. They are not applied automatically — call them from your own service provider's boot() method:
use Syriable\Filament\Plugins\Utilities\UtilitiesServiceProvider; public function boot(): void { UtilitiesServiceProvider::initializeFilamentComponents(); UtilitiesServiceProvider::microFilamentComponents(); UtilitiesServiceProvider::configureFactoryIcons(); UtilitiesServiceProvider::configureActivitylogTimeline(); }
initializeFilamentComponents() applies global defaults via configureUsing():
- end-aligned form actions on pages,
TextInputcapped at 255 characters and trimmed,- trimmed
Textarea, - consistent modal alignment/width for actions,
- a single-column responsive
Schemadefault, - when
codewithdennis/filament-advanced-componentsis installed,AdvancedTextColumnvalues become clickablemailto:/tel:/https://wa.me/links.
microFilamentComponents() registers convenience macros:
ToggleButtons::fullWidth(),Section::prime()(a rounded, bordered container),Textarea::counter()— renders a live character counter using this package'sfilament-utilities::filament.components.textareafield wrapper.
configureFactoryIcons() registers your application's resources/svg/icons directory as a Blade Icons set (fluxwork, prefix flux).
configureActivitylogTimeline() applies compact defaults and a per-event icon map to syriable/filament-activitylog's ActivitylogTimeline component.
The
AdvancedTextColumnintegration requires the optional, paidcodewithdennis/filament-advanced-componentspackage. It is guarded byclass_exists(), so the rest of the defaults work without it.
Testing
composer test
Other useful scripts:
composer analyse # PHPStan composer lint # Laravel Pint
Changelog
Please see CHANGELOG for more information on what has changed recently.
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.
统计信息
- 总下载量: 2
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-06-07