Download the PHP package samuel-nunes/laravel-ddd-toolkit without Composer

On this page you can find all versions of the php package samuel-nunes/laravel-ddd-toolkit. 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-ddd-toolkit

Laravel DDD Toolkit

Laravel DDD Toolkit is a Composer package for building large, modular Laravel applications with vertical modules, hexagonal architecture by default, and pragmatic tactical DDD patterns.

Website: samuelnunesdev.github.io/laravel-ddd-toolkit-site

It organizes the application vertically by business capability, such as Order, Payment, Customer, or Billing, while keeping the Laravel experience familiar: Artisan commands, service providers, routes, Eloquent, jobs, listeners, requests, and controllers still work as expected.

This package is intentionally pragmatic. It is not an academic DDD framework, it does not replace Laravel, and it does not force CQRS, Event Sourcing, repositories, or a rigid architecture on every project.

Summary

Why This Exists

Laravel is productive and expressive, but large applications often become hard to navigate when code is grouped mainly by technical layer:

Laravel DDD Toolkit addresses this by encouraging a modular monolith organized by business capability:

Each module is a feature, business capability, subdomain, or bounded context depending on the size of the application.

Compatibility

Architecture

The toolkit combines two complementary ideas:

The default positioning is:

Dependency direction is separate from execution flow.

Allowed dependency direction:

Typical execution flow:

Ports live in Application/Ports/In and Application/Ports/Out. Adapters live in Infrastructure.

An external integration can act as an anti-corruption layer when it protects the domain from external APIs, payloads, SDK models, or vendor-specific concepts. ACL is treated as a role an integration can play, not as the primary command name.

Installation

The install command creates:

On Laravel 11 and newer, it also registers App\Providers\ModulesServiceProvider in:

If legacy folders such as app/Models, app/Services, or app/Repositories exist, the command may ask if you want to review them. It never removes those folders automatically.

The installer never overwrites an existing AGENTS.md unless --force-agents is explicitly used.

Installer options:

AI-friendly projects

Laravel DDD Toolkit can publish an AGENTS.md file to help AI coding agents understand the architecture of your Laravel project.

If your project already has an AGENTS.md, it will not be overwritten.

To merge Laravel DDD Toolkit instructions into an existing file:

To skip publishing:

To overwrite:

The file guides agents to preserve vertical modules, hexagonal architecture by default, ports in Application, adapters in Infrastructure, a Domain layer without Laravel dependencies, make:module instead of make:domain, and ddd:check before finishing architectural changes.

Quick Start

Create an Order module, define an outbound persistence port, bind it to an Eloquent adapter, and create a use case:

Then run the architecture checker:

Module AI docs

When creating a module, Laravel DDD Toolkit can generate module-level documentation for humans and AI agents.

You can provide context directly:

Or from a file:

To skip AI docs:

Generated files:

These files do not use AI. They are generated from templates using the context provided by the developer.

Core Commands

Create a module:

Create tactical domain and application classes:

Create Ports and Adapters:

Create an external integration:

Run architecture checks and discovery cache commands:

Existing files are not overwritten unless you pass --force.

Generated Structure

By default, make:module creates a vertical module with hexagonal structure:

Domain/Contracts is not created by the default preset. Use explicit ports in Application/Ports/In and Application/Ports/Out instead.

Generated Code Example

An outbound Port is generated as a PHP interface in the application layer:

A persistence Adapter can implement that Port from the infrastructure layer:

When possible, the adapter command also registers the binding in the module provider:

Presets

Hexagonal is the default:

This is equivalent to:

Alternative presets are available when a project needs less or more structure:

Discovery Cache

The generated ModulesServiceProvider discovers module routes and providers automatically.

It loads route files from:

It registers module service providers from:

For production, cache discovery into a manifest:

The manifest is written to:

Clear it with:

When the cache exists, discovery uses the manifest. When it does not exist, filesystem discovery is used.

Architecture Checks

Run:

By default, this validates basic hexagonal rules:

Validate a single module:

The command does not alter files and returns a non-zero exit code when violations are found, so it can be used in CI.

Configuration

The published config lives at:

Default options:

Repositories And Eloquent

Eloquent is supported. Active Record is part of Laravel's productivity story and can coexist with domain-oriented code.

Repositories are disabled by default:

Create repositories or outbound ports only when they solve a real problem, such as hiding complex persistence, integrating external storage, or protecting application/domain code from query details.

Force a repository generation:

For hexagonal persistence boundaries, prefer an outbound port plus an infrastructure adapter:

Custom Stubs

Publish the package stubs when you want to customize generated code:

Published stubs are placed in:

When a custom stub exists there, the generator uses it instead of the package default.

Contributing

Contributions are welcome. Before opening a pull request, run:

Development

Install dependencies:

Run tests:

The test suite uses Orchestra Testbench to validate package behavior against Laravel.

Run static analysis:

Run the full local check:

When PHP or Composer are not available on the host machine, the same checks can be run with the Psalm Docker image:

License

This project is open-sourced software licensed under the MIT license.


All versions of laravel-ddd-toolkit with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
illuminate/console Version ^11.0|^12.0|^13.0
illuminate/filesystem Version ^11.0|^12.0|^13.0
illuminate/support Version ^11.0|^12.0|^13.0
nikic/php-parser Version ^5.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 samuel-nunes/laravel-ddd-toolkit contains the following files

Loading the files please wait ...