Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Filament Modules Laravel Package

savannabits/filament-modules

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Architecture Fit

  • Modularity Alignment: The package leverages nwidart/laravel-modules to decompose Filament admin panels into discrete, self-contained modules (e.g., Users, Products, Reports). This aligns well with Domain-Driven Design (DDD) and microservice-like isolation within a monolith, reducing coupling between admin features.
  • Filament-Specific Abstraction: Built for Filament 4.x, it extends Filament’s resource/panel system with module-aware bootstrapping, middleware, and service providers. This avoids reinventing modular patterns for Filament’s unique architecture (e.g., FilamentPanel, Resource classes).
  • Laravel 11+ Compatibility: Uses Laravel’s package discovery and container binding optimally, ensuring seamless integration with modern Laravel features (e.g., app:providers, bootstrap/app.php changes).

Integration Feasibility

  • Low Friction for Filament Apps: Designed as a drop-in replacement for Filament’s default resource/panel structure. Existing Filament resources can be gradually migrated to modules without breaking core functionality.
  • Dependency Graph: Relies on:
    • nwidart/laravel-modules (v11+) for module scaffolding.
    • Filament 4.x (core dependency).
    • Laravel 11+ (for package auto-discovery). Risk: Tight coupling with nwidart/laravel-modules may require updates if that package evolves significantly.
  • Customization Points:
    • Module bootstrapping hooks (e.g., bootModule()).
    • Module-specific middleware (e.g., ModuleMiddleware).
    • Overridable module templates (e.g., resources/views/modules/module.blade.php).

Technical Risk

Risk Area Severity Mitigation
Filament Version Lock Medium Package is tied to Filament 4.x; upgrades to Filament 5.x may require rework.
Module Isolation Gaps Low Shared services (e.g., Auth, Database) must be explicitly configured per module.
Performance Overhead Low Module auto-loading adds minimal overhead; caching (config('modules.cache')) mitigates this.
Testing Complexity Medium Modules introduce nested service providers; require module-specific test suites.
Migration Path High Large Filament apps may need phased migration (e.g., start with non-critical modules).

Key Questions

  1. Module Granularity:
    • Should modules align with business domains (e.g., Inventory, CRM) or technical layers (e.g., Auth, Reports)?
    • Tradeoff: Too fine-grained → overhead; too coarse → loses modular benefits.
  2. Shared State Management:
    • How will modules share services (e.g., Cache, Queue) or database connections without tight coupling?
    • Example: Use ModuleServiceProvider::boot() to bind shared services per module.
  3. CI/CD Impact:
    • Will module-specific deployments (e.g., feature flags) be needed, or is a monolithic release sufficient?
  4. Filament Panel Integration:
    • How will modules be grouped/ordered in the Filament dashboard? (Custom Panel configuration required.)
  5. Legacy Compatibility:
    • If migrating from Filament 3.x, what’s the minimum viable module subset to adopt first?

Integration Approach

Stack Fit

  • Primary Use Case: Ideal for large-scale Filament applications where:
    • Teams need isolated ownership of admin features (e.g., frontend vs. backend teams).
    • Feature toggling or gradual rollouts are required.
    • Third-party plugins (e.g., spatie/laravel-permission) must be scoped to specific modules.
  • Anti-Patterns:
    • Overkill for small Filament apps (<10 resources).
    • Avoid if monolithic admin panels are preferred (e.g., all resources in one Dashboard).

Migration Path

  1. Assessment Phase:
    • Audit existing Filament resources/panels for module boundaries.
    • Identify shared dependencies (e.g., Auth, Notifications) that may need module-aware refactoring.
  2. Pilot Module:
    • Convert one non-critical resource (e.g., Settings) into a module.
    • Validate:
      • Module auto-registration (config/modules.php).
      • Resource routing (/modules/settings/resources).
      • Middleware isolation (e.g., auth:admin per module).
  3. Incremental Rollout:
    • Phase 1: Core modules (e.g., Users, Products).
    • Phase 2: Utility modules (e.g., Logs, API Keys).
    • Phase 3: Third-party integrations (e.g., Stripe, Mailchimp).
  4. Cutover:
    • Replace FilamentPanel with ModulePanel in app/Providers/FilamentServiceProvider.php.
    • Update routes/web.php to use module-aware routes (if custom).

Compatibility

Component Compatibility Notes
Filament Resources ✅ Full support (convert to modules). Use php artisan module:make command.
Filament Panels ✅ Supported via ModulePanel. Extends FilamentPanel with module awareness.
Laravel Modules ✅ Core dependency (nwidart/laravel-modules). Follows its conventions (e.g., Modules/Users/Resources/ structure).
Third-Party Packages ⚠️ Varies (e.g., spatie/laravel-permission works but may need module scoping). Test with critical packages pre-migration.
Custom Filament Plugins ❌ May require updates. Plugins using Resource hooks may need module-aware overrides.

Sequencing

  1. Pre-requisites:
    • Upgrade to Laravel 11+ and Filament 4.x.
    • Install dependencies:
      composer require coolsam/filament-modules nwidart/laravel-modules
      
  2. Configuration:
    • Publish module config:
      php artisan vendor:publish --provider="Coolsam\Modules\ModulesServiceProvider"
      
    • Define module list in config/modules.php.
  3. Development:
    • Generate modules:
      php artisan module:make Users --resource --panel
      
    • Customize Modules/Users/Module.php (e.g., middleware, routes).
  4. Testing:
    • Test module isolation (e.g., delete a module and verify no regressions).
    • Validate Filament dashboard rendering.
  5. Deployment:
    • Deploy modules incrementally (e.g., via feature flags).
    • Monitor module-specific logs (modules.log).

Operational Impact

Maintenance

  • Pros:
    • Isolated Updates: Modules can be updated independently (e.g., Products module without touching Users).
    • Reduced Merge Conflicts: Team-specific modules minimize cross-team dependencies.
    • Cleaner Codebase: Enforces separation of concerns (e.g., UsersModule, ReportsModule).
  • Cons:
    • Module-Specific Debugging: Logs and errors must include module context (e.g., [UsersModule] Error: ...).
    • Configuration Overhead: Each module may need:
      • Dedicated ModuleServiceProvider.
      • Module-specific middleware/policies.
      • Custom views (if overriding defaults).
  • Tooling:
    • Use php artisan module:list to manage modules.
    • Implement module health checks (e.g., php artisan module:check).

Support

  • Troubleshooting:
    • Module-Specific Commands:
      php artisan module:install Users
      php artisan module:uninstall Reports
      
    • Debugging Tips:
      • Check Modules/Users/Database/Migrations/ for module-specific DB issues.
      • Use dd(app()->make('module')); to inspect module container bindings.
  • Documentation Gaps:
    • Limited examples for complex module interactions (e.g., cross-module data sharing).
    • Workaround: Extend Module class for custom logic (e.g., app/Modules/CustomModule.php).
  • Support Matrix:
    Issue Type Resolution Path
    Module not loading Check config/modules.php and app/Providers/ModulesServiceProvider.php.
    Fil
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
facebook/capi-param-builder-php
babelqueue/symfony
hamzi/corewatch
minionfactory/raw-hydrator
hexters/coinpayment
rjcodes/rjcms
act-training/laravel-permissions-manager
alimarchal/laravel-chart-of-accounts
babenkoivan/elastic-scout-driver
mkwebdesign/filament-watchdog-v5
renatomarinho/laravel-page-speed
zedmagdy/filament-business-hours
renatovdemoura/blade-elements-ui
devgeek/beacon-admin
benjamin-rqt/data-watcher-bundle
atriumphp/atrium
sandermuller/package-boost-laravel
sandermuller/boost-skills
redaxo/core
yusufgenc/filament-api-forge