- How does this package reduce boilerplate for Filament plugins?
- The package provides traits like `HasResources`, `HasWidgets`, and `HasPolicies` that abstract repetitive setup code (e.g., resource registration, policy binding, or widget scaffolding). Instead of manually defining routes, views, or permissions, you extend the trait and focus on custom logic, cutting hours of boilerplate per plugin.
- Can I use this with Laravel 10 or 11?
- Yes, the package is fully compatible with Laravel 10 and 11, but test the `app()->plugin()` macro behavior if you’re using Laravel’s new context binding features. The core functionality remains unchanged, as it relies on Filament’s v3.x architecture.
- What if multiple plugins use the same trait (e.g., `HasWidgets`)—will there be namespace collisions?
- The package includes plugin-scoped service containers and follows Filament’s modular design to prevent collisions. Each plugin’s traits operate within its own namespace, and you can further isolate logic using the `plugin:extend` hook for custom post-registration behavior.
- How do I customize traits (e.g., add columns to a resource table) without subclassing?
- Traits like `HasResources` support extension via the `plugin:extend` hook or by overriding specific methods (e.g., `configureTable`). For example, you can inject custom columns in a `configureTable` method called after the trait’s default setup, avoiding subclassing entirely.
- Does this package work with Filament v2.x?
- No, this package is designed for **Filament v3.x only**. If you’re on v2.x, you’ll need to upgrade to Filament 3 first. The package leverages v3’s improved plugin system, so migration is required for compatibility.
- How do I handle plugin-specific testing (e.g., mocking traits or widgets)?
- The package includes a `PluginTestCase` base class to simplify testing, but you’ll need to manually mock trait interactions (e.g., `HasResources`) using Laravel’s testing tools. For debugging, use Xdebug with the `plugin:debug` helper to inspect trait method calls and their context.
- What’s the deprecation policy if Filament changes its internals (e.g., resource registration)?
- The package follows Filament’s versioning closely. Breaking changes will be documented in the changelog, and minor Filament updates (e.g., v3.1 → v3.2) are guaranteed backward-compatible. Major Filament updates may require trait adjustments, but the package aims to provide migration paths.
- Can I use this for non-plugin Filament features (e.g., custom admin panels)?
- No, this package is **optimized for Filament plugins only**. It won’t help with standalone admin panels or non-plugin Filament features. The traits and helpers are designed to work within Filament’s plugin ecosystem, not as a general-purpose toolkit.
- How do I migrate an existing plugin to use these traits?
- Start by replacing manual resource registration (e.g., `Resource::for()`) with the `HasResources` trait. For policies, swap custom bindings for `HasPolicies`. Use the `plugin:unregister` hook to clean up old registrations. Test incrementally—begin with low-criticality plugins (e.g., widgets) before rolling out to core resources.
- Are there performance concerns with using multiple traits in a single plugin?
- The package is lightweight, but if you’re scaling to 100+ resources, profile with `tideways/xhprof` to monitor overhead. Traits are lazy-loaded and designed for minimal runtime impact. For large plugins, consider splitting functionality across smaller plugins to isolate concerns.