internachi/modularize
Add InterNACHI Modular support to your Laravel package commands with simple traits. Provides a --module option and helpers to resolve module config. Includes a GeneratorCommand trait so generated files land in the module directory with correct namespaces.
spatie/laravel-package-tools) and modular monoliths, where commands must dynamically target module-specific directories. The declarative use Modularize pattern ensures backward compatibility while enabling modular behavior, reducing merge conflicts in large-scale applications.ModuleConfig, introducing moderate technical risk (~30%). The hook-based design (e.g., getDefaultNamespace()) provides flexibility but demands validation with complex module hierarchies before full adoption.ModularizeGeneratorCommand is highly efficient for file generators (e.g., make:controller, make:migration), automating 90% of module-aware path/namespace logic. The automatic --module flag injection and namespace resolution reduce boilerplate significantly. However, non-generator commands must use the lighter Modularize trait, which lacks built-in file-system integration, potentially requiring custom logic for specialized use cases (e.g., dynamic file placement).internachi/modular Dependency: The package is tightly coupled to internachi/modular, which may introduce vendor lock-in risk. However, the MIT license and open-source nature mitigate this concern. API stability of ModuleConfig is critical; audit its changelog and backward compatibility guarantees to ensure long-term viability. If internachi/modular undergoes breaking changes, the package may require updates, adding maintenance overhead.make:controller, make:policy, or make:migration, where files must reside in module-specific directories. Non-generator commands (e.g., php artisan queue:work) are unsupported, requiring custom logic if module awareness is needed.--module flag, ensuring a smooth migration path. Existing CLI workflows are unaffected, reducing resistance from developers accustomed to non-modular commands.ModuleConfig object provides name, base path, and namespace helpers, but custom module structures (e.g., non-standard paths) may require overrides. The package assumes PSR-4 compliance, which may not align with all modular architectures.ModuleConfig, increasing integration effort.internachi/modular Stability: The package’s long-term viability depends on internachi/modular’s API stability. If the underlying module system changes, the package may need updates, adding maintenance burden.Modularize trait works for any command, file-system operations (e.g., dynamic file placement) require custom logic, increasing development effort for non-standard use cases.Module Architecture Compatibility:
Laravel Version Strategy:
Dependency Management:
internachi/modular’s API stability compare to alternatives (e.g., spatie/laravel-modules)?internachi/modular undergoes breaking changes?Use Case Alignment:
make:controller), or are there non-generator commands requiring module awareness?Performance Impact:
--module flag add measurable overhead to command execution?Team Adoption:
internachi/modular, though it may work with similar module systems (e.g., spatie/laravel-modules) with minor adjustments.Upgrade Laravel (if needed):
Select Target Commands:
make:controller, make:migration) for immediate ROI.Integrate Traits:
use InterNACHI\Modularize\Support\Modularize;
class MyCommand extends Command { use Modularize; }
use InterNACHI\Modularize\Support\ModularizeGeneratorCommand;
class MakeWidget extends GeneratorCommand { use ModularizeGeneratorCommand; }
Validate Module Paths:
ModuleConfig for custom paths (if needed):
$module->setNamespace('Custom\\Namespace');
Update Documentation:
--module flag for developers.make:policy --module=Blog).Phase Rollout:
How can I help you explore Laravel packages today?