{"id":14975195,"url":"https://github.com/savannabits/filament-modules","last_synced_at":"2025-04-05T17:06:51.489Z","repository":{"id":65157016,"uuid":"583652206","full_name":"savannabits/filament-modules","owner":"savannabits","description":"Integration of Filament with nWidart/laravel-modules: Create independent Filament Files for each Laravel Module","archived":false,"fork":false,"pushed_at":"2024-07-26T11:58:16.000Z","size":832,"stargazers_count":107,"open_issues_count":2,"forks_count":21,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-10-30T08:03:27.713Z","etag":null,"topics":["filamentphp","laravel","laravel-modules","nwidart-modules"],"latest_commit_sha":null,"homepage":"https://filamentphp.com/plugins/coolsam-modules","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/savannabits.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":".github/CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":".github/SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"coolsam"}},"created_at":"2022-12-30T13:04:10.000Z","updated_at":"2024-10-28T05:38:38.000Z","dependencies_parsed_at":"2024-11-13T06:03:35.436Z","dependency_job_id":null,"html_url":"https://github.com/savannabits/filament-modules","commit_stats":{"total_commits":147,"total_committers":8,"mean_commits":18.375,"dds":0.5306122448979591,"last_synced_commit":"31f4bd28d52065acad3cfc040e23b666889b4a1c"},"previous_names":[],"tags_count":29,"template":false,"template_full_name":"filamentphp/plugin-skeleton","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/savannabits%2Ffilament-modules","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/savannabits%2Ffilament-modules/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/savannabits%2Ffilament-modules/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/savannabits%2Ffilament-modules/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/savannabits","download_url":"https://codeload.github.com/savannabits/filament-modules/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247362712,"owners_count":20926827,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["filamentphp","laravel","laravel-modules","nwidart-modules"],"created_at":"2024-09-24T13:51:41.601Z","updated_at":"2025-04-05T17:06:51.470Z","avatar_url":"https://github.com/savannabits.png","language":"PHP","funding_links":["https://github.com/sponsors/coolsam"],"categories":[],"sub_categories":[],"readme":"# Filament Modules v4.x\n\n[![Latest Version on Packagist](https://img.shields.io/packagist/v/coolsam/modules.svg?style=flat-square)](https://packagist.org/packages/coolsam/modules)\n[![GitHub Tests Action Status](https://img.shields.io/github/actions/workflow/status/savannabits/filament-modules/run-tests.yml?branch=main\u0026label=tests\u0026style=flat-square)](https://github.com/savannabits/filament-modules/actions?query=workflow%3Arun-tests+branch%3Amain)\n[![GitHub Code Style Action Status](https://img.shields.io/github/actions/workflow/status/savannabits/filament-modules/fix-php-code-style-issues.yml?branch=main\u0026label=code%20style\u0026style=flat-square)](https://github.com/savannabits/filament-modules/actions?query=workflow%3Afix-php-code-style+branch%3Amain)\n[![Total Downloads](https://img.shields.io/packagist/dt/coolsam/modules.svg?style=flat-square)](https://packagist.org/packages/coolsam/modules)\n\n\u003e **NOTE:** This documentation is for **version 4.x** of the package, which only supports **Laravel 11** and\n**nwidart/laravel-modules ^11**. If you are using Laravel 10, please refer to\n\u003e the [3.x documentation](https://github.com/savannabits/filament-modules/tree/3.x).\n\n![image](https://github.com/savannabits/filament-modules/assets/5610289/ba191f1d-b5ee-4eb9-9db7-d42a19cc8d38)\n\nThis package brings the power of modules to Laravel Filament. It allows you to organize your filament code into fully\nautonomous modules that can be easily shared and reused across multiple projects.\nWith this package, you can turn each of your modules into a fully functional Filament Plugin with its own resources,\npages, widgets, components and more. What's more, you don't even need to register each of these plugins in your main\nFilament Panel. All you need to do is register the `ModulesPlugin` in your panel, and it will take care of the rest for\nyou.\n\nThis package is simple a wrapper of [nwidart/laravel-modules](https://docs.laravelmodules.com) package to make it work\nwith Laravel Filament.\n\n## Features\n\n- A command to prepare your module for Filament\n- A command to create a Filament Cluster in your module\n- A command to create additional Filament Plugins in your module\n- A command to create a new Filament resource in your module\n- A command to create a new Filament page in your module\n- A command to create a new Filament widget in your module\n- Organize your admin panel into Cluster, one for each supported module.\n\n## Requirements\n\nv4.x of this package requires the following dependencies:\n\n- Laravel 11.x or higher\n- Filament 3.x or higher\n- PHP 8.2 or higher\n- nwidart/laravel-modules 11.x\n\nIf you are using Laravel 10 please use [version 3.x](https://github.com/savannabits/filament-modules/tree/3.x) instead.\n\n## Installation\n\nYou can install the package via composer:\n\n```bash\ncomposer require coolsam/modules:^4\n```\n\nThis will automatically install `nwidart/laravel-modules: ^11` as well. Make sure you go through\nthe [documentation](https://laravelmodules.com/docs/v11/introduction) to understand how to use the package and to\nconfigure it properly\nbefore proceeding.\n\nYou can publish the config file with:\n\n```bash\nphp artisan vendor:publish --tag=\"modules-config\"\n```\n\nAlternatively, just run the installation command and follow the prompts:\n\n```bash\nphp artisan module:filament:install\n```\n\n### Configuration\n\nAfter publishing the config file, you can configure the package to your liking. The configuration file is located\nat `config/filament-modules.php`.\nThe following can be adjusted in the configuration file:\n\n- **auto-register-plugins**: If set to true, the package will automatically register all the plugins in your modules.\n  Otherwise, you will need to register each plugin manually in your Filament Panel.\n- **clusters.enabled**: If set to true, a cluster will be created in each module during the `module:filament:install`\n  command and all filament files for that module may reside inside that cluster. Otherwise, filament files will reside\n  in Filament/Resources, Filament/Pages, Filament/Widgets, etc.\n- **clusters.use-top-navigation**: If set to true, the top navigation will be used to navigate between clusters while\n  the actual links will be loaded as a side sub-navigation. In my opinion, this improves UX. Otherwise, the package will\n  honor the configuration that you have in your panel.\n\n## Usage\n\n### Register the plugin\n\nThe package comes with a `ModulesPlugin` that you can register in your Filament Panel. This plugin will automatically\nload all the modules in your application and register them as Filament plugins.\nIn order to achieve this, you need to register the `ModulesPlugin` in your panel of choice (e.g. Admin Panel) like so:\n\n```php\n// e.g. in App\\Providers\\Filament\\AdminPanelProvider.php\n \nuse Coolsam\\Modules\\ModulesPlugin;\npublic function panel(Panel $panel): Panel\n{\n    return $panel\n        ...\n        -\u003eplugin(ModulesPlugin::make());\n}\n```\n\nThat's it! now you are ready to start creating some filament code in your module of choice!\n\n### Installing Filament in a module\n\nIf you don't have a module already, you can generate one using the `module:make` command like so:\n\n```bash\nphp artisan module:make MyModule\n```\n\nNext, run the `module:filament:install` command to generate the necessary Filament files and directories in your module:\n\n```bash\nphp artisan module:filament:install MyModule\n```\n\nThis will guide you interactively on whether you want to organize your code in clusters, and whether you would like to\ncreate a default cluster.\nAt the end of this installation, you will have the following structure in your module:\n\n- Modules\n    - MyModule\n        - app\n            - Filament\n                - Clusters\n                    - MyModule\n                        - Pages\n                        - Resources\n                        - Widgets\n                    - **MyModule.php**\n                - Pages\n                - Resources\n                - Widgets\n                - **MyModulePlugin.php**\n\nAs you can see, there are two main files generated: The plugin class and optionally the cluster class. After generation,\nyou are free to make any modifications to these classes as you may see fit.\n\nThe **plugin** will be loaded automatically unless the configuration is set otherwise. As a result, it will also load\nall its clusters automatically.\n\nYour module is now ready to be used in your Filament Panel. Use the following commands during development to generate\nnew resources, pages, widgets and clusters in your module:\n\n### Creating a new resource\n\n```bash\nphp artisan module:make:filament-resource\n```\n\nFollow the interactive prompts to create a new resource in your module.\n\n### Creating a new page\n\n```bash\nphp artisan module:make:filament-page\n```\n\nFollow the interactive prompts to create a new page in your module.\n\n###Creating a new widget\n\n```bash\nphp artisan module:make:filament-widget\n```\n\nFollow the interactive prompts to create a new widget in your module.\n\n### Creating a new cluster\n\n```bash\nphp artisan module:make:filament-cluster\n```\n\nFollow the interactive prompts to create a new cluster in your module.\n\n### Creating a new plugin\n\n```bash\nphp artisan module:make:filament-plugin\n```\n\nFollow the interactive prompts to create a new plugin in your module.\n\n### Create a new Filament Theme\n\n```bash\nphp artisan module:make:filament-theme\n```\n\n\n\n### Follow the instructions to protect your resources and pages if your module is not active.\n\n```php\nuse Coolsam\\Modules\\Resource;\n```\nuse the above resource class instead of `use Filament/Resources/Resource;` into your resource class file to protect your resources.\n\n```php\nuse Coolsam\\Modules\\Page;\n```\nuse the above page class instead of `use Filament/Pages/Page;` into your page class file to protect your pages.\n\n```php\nuse Coolsam\\Modules\\TableWidget;\n```\nuse the above page class instead of `use Filament/Pages/TableWidget;` into your widget class file to protect your TableWidget.\n\n```php\nuse Coolsam\\Modules\\ChartWidget;\n```\nuse the above page class instead of `use Filament/Pages/ChartWidget;` into your widget class file to protect your ChartWidget.\n\n```php\nuse Coolsam\\Modules\\StatsOverviewWidget;\n```\nuse the above page class instead of `use Filament/Pages/StatsOverviewWidget;` into your widget class file to protect your StatsOverviewWidget.\n\n```php\nuse CanAccessTrait;\n```\nuse the above trait directly into your resource and page class file to protect your resources and pages.\n\n## Testing\n\n```bash\ncomposer test\n```\n\n## Changelog\n\nPlease see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.\n\n## Contributing\n\nPlease see [CONTRIBUTING](.github/CONTRIBUTING.md) for details.\n\n## Security Vulnerabilities\n\nPlease review [our security policy](../../security/policy) on how to report security vulnerabilities.\n\n## Credits\n\n- [Sam Maosa](https://github.com/coolsam726)\n- [All Contributors](../../contributors)\n\n## License\n\nThe MIT License (MIT). Please see [License File](LICENSE.md) for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsavannabits%2Ffilament-modules","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsavannabits%2Ffilament-modules","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsavannabits%2Ffilament-modules/lists"}