Download the PHP package hatchyu/laravel-modular without Composer

On this page you can find all versions of the php package hatchyu/laravel-modular. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-modular

Laravel Modular

Latest Version on Packagist Total Downloads

The Architectural Backbone for Enterprise Laravel Applications

Laravel Modular is a high-performance, zero-boilerplate Domain-Driven Design (DDD) 4-Layer Modular Architecture and Pragmatic CQRS framework engineered for senior developers and enterprise teams building large-scale, mission-critical software.

Whether you are architecting an ERP, CRM, Banking platform, Healthcare system, or Multi-domain enterprise SaaS, this package delivers the strict architectural guardrails, automated boundary enforcement, and production-optimized tooling needed to scale your modular monolith with total confidence.

[!TIP] Looking for a Simpler Modular Setup?
If you are building standard CRUD apps, MVPs, small-to-medium SaaS, or websites and want feature modularity without the ceremony of DDD layers, CQRS actions, and repository interfaces, check out our lightweight Laravel-native companion package:
πŸ‘‰ hatchyu/laravel-modular-lite (composer require hatchyu/laravel-modular-lite)


Key Features


Architecture Blueprint (DDD 4-Layer)

Each module (modules/{ModuleName}/) is structured into four explicit architectural layers plus database and delivery files:


Standard Module Namespaces

Component Target Namespace Example
Eloquent Model Modules\Customer\Domain\Models\Customer
Domain Policy Modules\Customer\Domain\Policies\CustomerPolicy
Domain Enum Modules\Customer\Domain\Enums\CustomerStatus
Domain Event Modules\Customer\Domain\Events\CustomerRegisteredEvent
CQRS Write Action Modules\Customer\Application\Actions\CreateCustomerAction
CQRS Read Query Modules\Customer\Application\Queries\ListCustomersQuery
Application DTO Modules\Customer\Application\Data\CreateCustomerData
App Service Modules\Customer\Application\Services\CustomerPricingService
App Rule Modules\Customer\Application\Rules\ValidCustomerTaxIdRule
HTTP Controller Modules\Customer\Interface\Controllers\Api\V1\CustomerController
Form Request Modules\Customer\Interface\Requests\UpdateCustomerRequest
Resource Modules\Customer\Interface\Resources\CustomerResource
Queue Job Modules\Customer\Infrastructure\Jobs\SyncCustomerToCrmJob
Model Factory Modules\Customer\Database\Factories\CustomerFactory
Database Seeder Modules\Customer\Database\Seeders\CustomerSeeder
Service Provider Modules\Customer\CustomerServiceProvider

Installation

Install the package via Composer:

1. Configure PSR-4 Autoloading

Add "Modules\\": "modules/" to your application's composer.json file under autoload.psr-4:

Then regenerate the Composer autoload files:

2. Publish Configuration (Optional)

This creates config/modular.php:


Module Lifecycle & Dependency Management

Every module can contain a local module.json manifest located at modules/{ModuleName}/module.json (automatically generated when running php artisan module:make):

Enabling & Disabling Modules

You can toggle modules on or off without deleting files or altering git history:

Disabled modules are completely excluded from service provider registration, route loading, database migrations, command discovery, view namespaces, and configuration merging.

Dependency Resolution & Topological Booting

When modules declare dependencies in module.json:

How Disabled or Missing Dependencies Are Handled

When a module depends on another module that is disabled or missing, the system handles it with clarity and safety:

  1. At Application Boot Time: If Order is enabled but depends on disabled Billing, ModuleRegistry::enabled() halts execution with an actionable exception:

    If the dependency does not exist in the codebase:

  2. At CLI Level (Safe Protection):

    • Preventing Accidental Breakage: If you attempt to disable a module that other active modules depend on, the command halts:

    • Enabling Prerequisite Validation: If you attempt to enable a module whose prerequisites are disabled, it guides you to enable the dependencies first:
  3. In Health Diagnostics (php artisan module:doctor): Displays the status of every module and flags any missing or disabled dependencies in the health inspection table.

Safe Module Renaming

Rename any module safely across your entire codebase:

This single command:

  1. Moves the directory from modules/Order to modules/Sales.
  2. Renames OrderServiceProvider.php to SalesServiceProvider.php and OrderDatabaseSeeder.php to SalesDatabaseSeeder.php.
  3. Refactors PHP namespaces, class names, view namespaces (order:: to sales::), and route prefixes across all module files.
  4. Updates "name": "Sales" in the module's module.json.
  5. Cross-module propagation: Scans all other modules in modules/ and updates any "dependencies" arrays containing "Order" to "Sales".
  6. Flushes and rebuilds the module discovery cache.

Artisan CLI Commands

All generator commands support nested sub-namespaces (e.g. V1/CreateOrderAction) and {--force} to overwrite existing files.

Scaffolding a Complete Module

Scaffold an entire DDD 4-layer module:

Domain Layer Generators

Application Layer Generators (CQRS & Use-Cases)

Interface Layer Generators (Delivery)

Infrastructure Layer Generators

Database Layer Generators

Test Generators

Inspection, Diagnostics & Optimization Commands


Production Deployment Optimization

In production environments, add php artisan module:cache to your deployment pipeline:

This compiles all module discovery paths, routes, and presence flags into bootstrap/cache/modules.php, eliminating filesystem scanning completely.


Testing & Quality

Run the test suite using Pest:

Check code formatting using Pint:


License

The MIT License (MIT). Please see License File for more information.


All versions of laravel-modular with dependencies

PHP Build Version
Package Version
Requires php Version ^8.3
illuminate/console Version ^11.0||^12.0||^13.0
illuminate/database Version ^11.0||^12.0||^13.0
illuminate/routing Version ^11.0||^12.0||^13.0
illuminate/support Version ^11.0||^12.0||^13.0
illuminate/view Version ^11.0||^12.0||^13.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package hatchyu/laravel-modular contains the following files

Loading the files please wait ...