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

Module Manager Laravel Package

nasirkhan/module-manager

Laravel module manager for Laravel Starter with version tracking, migration baselines/updates, dependency checks, publish/diff workflows, and enable/disable lifecycle commands. Includes scaffolding, removal, and test generation via Artisan.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Architecture Fit

  • Modular Monolith Alignment: The package excels in modular Laravel applications where feature isolation, dependency management, and lifecycle control are critical. It enforces a structured module architecture (e.g., Modules/{Module}/) with clear separation of concerns (routes, migrations, tests, etc.), aligning with Laravel’s service provider and package conventions.
  • Laravel Starter Dependency: Tightly coupled with Laravel Starter (a monolithic starter kit), which may limit flexibility if migrating to a microservices or decoupled architecture. However, this is ideal for large-scale Laravel applications needing modularity without full microservice overhead.
  • Namespace Isolation: Automatic namespace rewriting during publishing (module:publish) ensures no vendor namespace collisions in published modules, a critical feature for maintainability.

Integration Feasibility

  • Laravel 12/13 Support: Requires PHP 8.3+, which is non-negotiable for new projects but may pose upgrade risks for legacy systems. Compatibility with Laravel’s latest features (e.g., route caching, optimized service providers) is assumed.
  • Migration Management: The MigrationTracker service automates migration state tracking, reducing manual schema table management. However, custom migration logic (e.g., non-standard table prefixes) may require overrides.
  • Dependency Resolution: module.json defines dependencies, but circular dependencies or version conflicts (e.g., Post requiring Category@1.0.0 while Category updates) could break builds. The package lacks explicit semantic versioning enforcement.

Technical Risk

  • Vendor Lock-in: Heavy reliance on Laravel Starter may complicate adoption in non-Starter projects. The package assumes specific directory structures (Modules/) and service provider patterns.
  • Performance Overhead: Dynamic module loading (via priority in module.json) could introduce runtime delays if modules are numerous or poorly optimized. No benchmarks or scaling guidance are provided.
  • Testing Gaps: While module:make-test generates tests, integration tests for module interactions (e.g., Post depending on Category) are not automated. The package’s 0 dependents suggest limited real-world validation.
  • Migration Safety: module:track-migrations --force is a nuclear option—no rollback mechanism exists for failed migration tracking. Downtime risk during composer update + migration sync.

Key Questions

  1. Architecture Compatibility:
    • Does the target application use a modular monolith or could it adapt to this structure?
    • Are there existing modules/packages that would conflict with this system?
  2. Dependency Management:
    • How will version conflicts (e.g., Post@1.0.0 requiring Category@1.0.0 while Category@2.0.0 exists) be handled?
    • Is there a strategy for backward compatibility during module updates?
  3. Performance:
    • What is the expected number of modules? How will module loading impact boot time?
    • Are there caching layers (e.g., for module:status) to mitigate runtime checks?
  4. Migration Strategy:
    • How will legacy migrations (outside Modules/) be integrated?
    • What’s the rollback plan if module:track-migrations --force corrupts state?
  5. Customization:
    • Can module templates (e.g., module:build) be extended to include project-specific files (e.g., custom middleware)?
    • How are shared resources (e.g., a User module used by Post and Comment) managed?

Integration Approach

Stack Fit

  • Ideal For:
    • Large Laravel applications with 5+ distinct features (e.g., e-commerce, CMS, SaaS platforms).
    • Teams using Laravel Starter or willing to adopt its conventions.
    • Projects requiring fine-grained feature toggling (enable/disable modules at runtime).
  • Poor Fit:
    • Microservices or decoupled architectures (this enforces a monolithic structure).
    • Legacy Laravel <12 projects (PHP 8.3+ requirement).
    • Minimalist applications (overhead may not justify benefits).

Migration Path

  1. Assessment Phase:
    • Audit existing codebase for conflicts with Modules/ structure (e.g., custom package namespaces).
    • Identify critical modules to prioritize for migration.
  2. Pilot Module:
    • Select a non-core module (e.g., Blog) and refactor it using module:build.
    • Test dependency resolution, migrations, and asset publishing.
  3. Incremental Rollout:
    • Migrate modules in priority order (highest priority in module.json first).
    • Use module:publish to extract vendor code into Modules/.
  4. Legacy Integration:
    • For non-module code, wrap in a "Core" module with priority: 10.
    • Use service provider binding to integrate legacy routes/services.

Compatibility

  • Laravel Services:
    • Service Providers: Modules register via ModuleServiceProvider, which extends Laravel’s ServiceProvider. Custom providers may need adjustments.
    • Routes/Middleware: Published modules auto-register routes in routes/web.php and routes/api.php. Conflicts require namespace prefixing (e.g., post::routes).
    • Views/Lang: Published assets override vendor files, which is ideal for customization but may break if vendor updates introduce changes.
  • Third-Party Packages:
    • Packages using Laravel’s package discovery (e.g., spatie/laravel-package-tools) may conflict with this system’s custom module loading.
    • Database packages (e.g., Eloquent models) must adhere to module-specific namespaces to avoid collisions.

Sequencing

  1. Prerequisites:
    • Upgrade to Laravel 12/13 and PHP 8.3.
    • Install nasirkhan/module-manager and nasirkhan/laravel-starter.
  2. Core Setup:
    • Run php artisan module:build Core to scaffold a base module.
    • Configure module.json for priority/dependencies.
  3. Module Migration:
    • For each module:
      • module:build {module} (if new).
      • module:publish {module} (to extract from vendor).
      • module:track-migrations {module} --force.
  4. Testing:
    • Validate module:status shows all modules as enabled.
    • Test module:dependencies for circular dependency errors.
  5. Deployment:
    • Run composer dump-autoload and php artisan config:clear.
    • Test migration rollouts in staging.

Operational Impact

Maintenance

  • Pros:
    • Isolated Updates: Modules can be updated independently (e.g., Post@2.0.0 without touching Category).
    • Dependency Visualization: module:dependencies provides clear graphs of module relationships.
    • Asset Customization: module:publish allows vendor file overrides without forking.
  • Cons:
    • Module-Specific Debugging: Errors may require namespace-aware Xdebug (e.g., Modules\Post\Http\Controllers vs. vendor\...).
    • Composer Overhead: Frequent composer dump-autoload may be needed after module:publish.
    • Migration Drift: Manual module:track-migrations is required after composer updates, risking schema mismatches.

Support

  • Troubleshooting:
    • Module Not Loading: Clear caches (php artisan cache:clear) and check module.json for typos in requires.
    • Migration Failures: Use module:detect-updates to identify new migrations before running migrate.
    • Dependency Conflicts: module:status --verbose shows unsatisfied dependencies.
  • Documentation Gaps:
    • No migration rollback guide for failed module:track-migrations.
    • Limited examples for custom module templates or shared dependencies.
    • No CI/CD templates for module-specific testing/deployment.

Scaling

  • Performance:
    • Module Loading: Prioritize critical modules (high priority) to load first. Test with 10+ modules to validate boot time.
    • Migration Tracking: For large databases, module:track-migrations may take minutes—schedule during low-traffic periods.
  • Team Scaling:
    • Ownership: Assign module owners to manage module.json, dependencies, and updates.
    • Onboarding: New developers must learn **module
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.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
christhompsontldr/phpsdk
enqueue/dsn
bunny/bunny
enqueue/test
enqueue/null
enqueue/amqp-tools
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport
twbs/bootstrap4