Download the PHP package timo-de-winter/filament-modifiable-plugins without Composer
On this page you can find all versions of the php package timo-de-winter/filament-modifiable-plugins. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download timo-de-winter/filament-modifiable-plugins
More information about timo-de-winter/filament-modifiable-plugins
Files in timo-de-winter/filament-modifiable-plugins
Package filament-modifiable-plugins
Short Description A helper package for when creating packages that provide filament resources.
License MIT
Homepage https://github.com/timo-de-winter/filament-modifiable-plugins
Informations about the package filament-modifiable-plugins
Filament Modifiable Plugins
A powerful package for creating highly customizable Filament plugins. This package empowers plugin developers to provide end-users with extensive customization options for resources, including navigation, forms, tables, clusters, and more.
Why Use This Package?
When building Filament plugins that provide resources or pages, you often want to give developers using your plugin the flexibility to customize various aspects such as:
- Navigation properties (labels, icons, groups, sorting)
- Page features (titles, slugs, schemas/forms)
- Table components (columns, filters, actions)
- Resource organization (clusters, parent items)
- Tenant ownership relationships
- And much more!
This package provides a clean, fluent API to make all of these customizations possible without requiring plugin users to override entire resource classes.
Requirements
- PHP 8.3+
- Laravel 11.x or 12.x
- Filament 4.1+ or 5.0+
Installation
Install the package via Composer:
No additional configuration or publishing is required. The package will auto-register via Laravel's package discovery.
Table of Contents
- For Plugin Users
- Basic Customization
- Navigation Customization
- Page Customization
- Form/Schema Customization
- Table Customization
- Targeting Specific Resources
- For Plugin Developers
- Setting Up Your Plugin
- Implementing Modifiable Resources
- Best Practices
For Plugin Users
If you've installed a Filament plugin that uses this package, you can easily customize the plugin's resources without modifying the plugin's source code.
Basic Customization
Here's a comprehensive example showing all available customization options:
Navigation Customization
Control how resources appear in your Filament panel's navigation:
All navigation methods support closures for dynamic values:
Page Customization
Customize page titles, slugs, and organization:
Form/Schema Customization
Customize the form schema used in your resource's create and edit pages:
Table Customization
Customize table columns, filters, and actions:
Alternatively, override the entire table configuration:
Targeting Specific Resources
When a plugin provides multiple resources, you can target specific ones by passing the resource class as the second parameter:
Custom Relations and Pages
Override the relations and pages for a resource:
For Plugin Developers
If you're developing a Filament plugin and want to make your resources customizable, follow these steps.
Setting Up Your Plugin
1. Add the Trait to Your Plugin Class
Add the CanModifyResources trait to your plugin class:
Implementing Modifiable Resources
1. Add the Trait to Your Resource
Add the CanBeModified trait to each resource you want to make customizable:
2. Implement Customizable Forms/Schemas
Use the getCustomSchema() method to allow form customization:
3. Implement Customizable Tables
Use the getCustomTable() method with CustomizableTable for table customization:
4. Implement Customizable Relations
Use the getCustomRelations() method:
5. Implement Customizable Pages
Use the getCustomPages() method:
Best Practices
-
Always provide sensible defaults - Your resources should work perfectly out of the box even if users don't customize them.
-
Use the helper methods consistently - Always use
getCustomSchema(),getCustomTable(), etc., in your resources to ensure customizations are applied. -
Document customization options - Let your users know which resources can be customized and provide examples in your plugin's documentation.
-
Test with customizations - Include tests that verify customizations work correctly.
- Use type hints - The package fully supports IDE autocompletion and type checking.
Complete Resource Example
Here's a complete example of a properly implemented modifiable resource:
Available Methods Reference
For Plugin Users (via Plugin Class)
| Method | Description |
|---|---|
navigationGroup($group, $resource) |
Set the navigation group |
label($label, $resource) |
Set the navigation label |
sort($order, $resource) |
Set the navigation sort order |
icon($icon, $resource) |
Set the navigation icon |
activeIcon($icon, $resource) |
Set the active navigation icon |
badge($badge, $resource) |
Set the navigation badge |
badgeColor($color, $resource) |
Set the navigation badge color |
badgeTooltip($tooltip, $resource) |
Set the navigation badge tooltip |
parentItem($parent, $resource) |
Set the navigation parent item |
cluster($cluster, $resource) |
Set the resource cluster |
title($title, $resource) |
Set the page title |
slug($slug, $resource) |
Set the resource slug |
tenantOwnershipRelationshipName($name, $resource) |
Set tenant ownership relationship |
schema($callback, $resource) |
Customize the form schema |
columns($columns, $resource) |
Set table columns |
filters($filters, $resource) |
Set table filters |
recordActions($actions, $resource) |
Set table record actions |
toolbarActions($actions, $resource) |
Set table toolbar actions |
customTable($callback, $resource) |
Override entire table configuration |
customRelations($relations, $resource) |
Set custom relation managers |
customPages($pages, $resource) |
Set custom pages |
All methods support closures for dynamic values and accept an optional resource class as the second parameter.
For Plugin Developers (via Resource Trait)
| Method | Description |
|---|---|
getCustomSchema($schema, $default) |
Get customized schema or default |
getCustomTable($table, $default) |
Get customized table or default |
getCustomRelations($default) |
Get customized relations or default |
getCustomPages($default) |
Get customized pages or default |
Testing
Run the test suite:
Run tests with coverage:
Fix code style issues:
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.
Security Vulnerabilities
If you discover a security vulnerability within this package, please send an e-mail to Timo de Winter via [email protected]. All security vulnerabilities will be promptly addressed.
Please review our security policy on how to report security vulnerabilities.
Credits
- Timo de Winter
- All Contributors
License
The MIT License (MIT). Please see License File for more information.
Support
If you find this package helpful, please consider:
- Starring the repository
- Sponsoring the development
- Sharing it with others who might benefit from it
For issues, questions, or suggestions, please use the GitHub issue tracker.
All versions of filament-modifiable-plugins with dependencies
filament/filament Version ^4.1||^5.0
illuminate/contracts Version ^11.28||^12.0||^13.0
spatie/laravel-package-tools Version ^1.16