PHPackages                             laravel-ddd/starter - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Framework](/categories/framework)
4. /
5. laravel-ddd/starter

ActiveLaravel-package[Framework](/categories/framework)

laravel-ddd/starter
===================

DDD Starter Kit for Laravel 13/12

v1.0.9(1mo ago)113MITPHPPHP ^8.4CI passing

Since May 7Pushed 1mo agoCompare

[ Source](https://github.com/MMoza/laravel-ddd)[ Packagist](https://packagist.org/packages/laravel-ddd/starter)[ RSS](/packages/laravel-ddd-starter/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (4)Dependencies (3)Versions (12)Used By (0)

Laravel DDD Starter Kit
=======================

[](#laravel-ddd-starter-kit)

A powerful and flexible Composer package that transforms a fresh Laravel 13/12 project into a fully structured Domain-Driven Design (DDD) architecture.

Features
--------

[](#features)

✅ **Complete DDD Structure** - Organized by domains/modules
✅ **Base Classes** - Entity, ValueObject, Repository, Service
✅ **12 Artisan Commands** - Generate modules, entities, services, and more
✅ **Interactive Installation** - Choose auth, sample module, docs, test package, and AI context
✅ **Automatic Test Generation** - PHPUnit, Pest, or none - tests generated with every command
✅ **Sample Module** - Optional Users module with full examples
✅ **API Ready** - Routes organized by domain
✅ **AI Agent Ready** - Optional AGENTS.md for AI context
✅ **Laravel 13 &amp; 12 Support** - Works with both versions
✅ **PHP 8.4+** - Modern PHP requirements

Installation
------------

[](#installation)

### 1. Create a new Laravel project

[](#1-create-a-new-laravel-project)

```
composer create-project laravel/laravel my-project
# or
laravel new my-project
cd my-project
```

### 2. Require the DDD Starter package

[](#2-require-the-ddd-starter-package)

```
composer require laravel-ddd/starter
```

### 3. Run the interactive installer

[](#3-run-the-interactive-installer)

```
php artisan ddd:install
```

You'll be asked:

- **Authentication**: None / Breeze / Sanctum
- **Sample Module**: None / Users (recommended)
- **Documentation**: English / Español / Both / No
- **AI Context**: Download AGENTS.md for AI agents?
- **Test Package**: PHPUnit / Pest / None

That's it! Your project is now DDD-structured.

Quick Start
-----------

[](#quick-start)

### Create a new module

[](#create-a-new-module)

```
php artisan ddd:make-module Products
```

This creates:

- Entities
- Repositories (interface + Eloquent implementation)
- Services
- Controllers
- Routes
- Migrations
- Tests (based on your selected test package)

### Generate individual components

[](#generate-individual-components)

```
# Create an entity + test
php artisan ddd:make-entity Product Products --migration --model

# Create a service + test
php artisan ddd:make-service ProductService Products

# Create a repository + test
php artisan ddd:make-repository ProductRepository Products --eloquent

# Create a controller
php artisan ddd:make-controller ProductController Products

# Create form requests
php artisan ddd:make-request StoreProductRequest Products
php artisan ddd:make-request UpdateProductRequest Products

# Create API resources
php artisan ddd:make-resource ProductResource Products

# Create value objects
php artisan ddd:make-value-object Price Products

# List all modules
php artisan ddd:list
```

Project Structure
-----------------

[](#project-structure)

After installation, your project will look like:

```
app/
├── Domains/                      # Your business logic organized by domain
│   ├── Base/                     # Shared base classes
│   │   ├── Entity.php            # Base entity class
│   │   ├── ValueObject.php       # Base value object class
│   │   ├── RepositoryInterface.php
│   │   └── Service.php           # Base service class
│   │
│   └── [Module]/                 # e.g., Users, Products, Orders
│       ├── Entities/
│       ├── ValueObjects/
│       ├── Repositories/
│       │   ├── ProductRepositoryInterface.php
│       │   └── EloquentProductRepository.php
│       ├── Services/
│       │   └── ProductService.php
│       ├── Http/
│       │   ├── Controllers/
│       │   │   └── ProductController.php
│       │   ├── Requests/
│       │   │   ├── StoreProductRequest.php
│       │   │   └── UpdateProductRequest.php
│       │   └── Resources/
│       │       └── ProductResource.php
│       ├── Routes/
│       │   └── Products.php
│       ├── Providers/
│       │   └── ProductsServiceProvider.php
│       ├── Database/
│       │   └── Migrations/
│       └── Tests/
│           ├── Unit/
│           │   ├── Entities/
│           │   └── Services/
│           └── Feature/
│
├── Application/                  # Use cases and actions
├── Infrastructure/               # External implementations
│   ├── Persistence/              # Eloquent repositories
│   └── HTTP/                     # HTTP adapters
├── Support/                      # Helpers and utilities
├── Http/Controllers/             # Thin controllers
└── Models/                       # Eloquent models (no business logic)

routes/
├── api.php
├── web.php
└── domains/                      # Domain-specific routes

tests/
├── Unit/Domains/
└── Feature/Domains/

docs/
├── ddd/                          # DDD documentation (optional)
│   ├── ddd-guide.md
│   ├── ddd-guide-es.md
│   ├── commands.md
│   ├── best-practices.md
│   └── routes.md
└── AGENTS.md                     # AI agent context (optional)

database/
├── migrations/
├── factories/
└── seeders/

```

Available Commands
------------------

[](#available-commands)

CommandDescription`ddd:install`Install DDD structure interactively`ddd:make-module`Create a complete module`ddd:make-entity`Create an entity + model + migration`ddd:make-service`Create a service class`ddd:make-repository`Create repository interface + implementation`ddd:make-value-object`Create a value object`ddd:make-controller`Create a thin controller`ddd:make-request`Create a form request`ddd:make-resource`Create an API resource`ddd:make-routes`Generate routes for a module`ddd:list`List all DDD modules`ddd:test`Run project testsFor detailed documentation, see [docs/commands.md](docs/commands.md)

Example: Building a Blog
------------------------

[](#example-building-a-blog)

```
# 1. Create the Posts module
php artisan ddd:make-module Posts

# 2. Create additional entity for comments
php artisan ddd:make-entity Comment Posts --migration --model

# 3. Create form requests
php artisan ddd:make-request StorePostRequest Posts
php artisan ddd:make-request UpdatePostRequest Posts

# 4. Create API resources
php artisan ddd:make-resource PostResource Posts
php artisan ddd:make-resource CommentResource Posts

# 5. Update routes/api.php
# Add: require app_path('Domains/Posts/Routes/Posts.php');

# 6. Run migrations
php artisan migrate
```

Architecture Principles
-----------------------

[](#architecture-principles)

### Entity

[](#entity)

Base class for domain entities. Contains business logic related to the entity itself.

```
class User extends Entity
{
    public function getId(): string
    {
        return $this->id;
    }
}
```

### ValueObject

[](#valueobject)

Immutable objects representing values in your domain.

```
class Email extends ValueObject
{
    public function __construct(protected string $value) {}

    public function getValue(): mixed { return $this->value; }
    public function isSame(ValueObject $vo): bool { ... }
    public function __toString(): string { ... }
}
```

### Repository

[](#repository)

Abstraction layer between domain and data persistence.

```
interface UserRepositoryInterface extends RepositoryInterface {}
class EloquentUserRepository implements UserRepositoryInterface {}
```

### Service

[](#service)

Orchestrates business operations using repositories.

```
class UserService extends Service
{
    public function __construct(protected UserRepositoryInterface $repository) {}
}
```

### Controller

[](#controller)

Thin controller that delegates to services.

```
class UserController extends Controller
{
    public function store(Request $request, UserService $service)
    {
        $user = $service->create($request->validated());
        return response()->json(['data' => $user], 201);
    }
}
```

Configuration
-------------

[](#configuration)

The package publishes a config file at `config/ddd.php`:

```
return [
    'domains_path' => app_path('Domains'),
    'application_path' => app_path('Application'),
    'infrastructure_path' => app_path('Infrastructure'),
    'support_path' => app_path('Support'),
    'providers_path' => app_path('Providers'),
    'default_namespace' => 'App\\Domains',
    'stubs_path' => __DIR__ . '/../src/stubs',
    'generate_tests' => true,
    'test_package' => 'phpunit',  // phpunit | pest | none
    'routes_path' => base_path('routes/domains'),
];
```

Publish the config:

```
php artisan vendor:publish --tag=ddd-config
```

Compatibility
-------------

[](#compatibility)

- **Laravel**: 13.x, 12.x
- **PHP**: 8.4+
- **License**: MIT

Support
-------

[](#support)

For issues, questions, or suggestions:

- GitHub Issues: [laravel-ddd/starter](https://github.com/laravel-ddd/starter/issues)
- Documentation: [docs/commands.md](docs/commands.md)

Documentation
-------------

[](#documentation)

- [DDD Guide (EN)](docs/ddd-guide.md) - Learn DDD concepts and compare with MVC
- [Guía DDD (ES)](docs/ddd-guide-es.md) - Aprende conceptos DDD y compáralo con MVC
- [Commands Reference](docs/commands.md) - All available commands
- [Best Practices](docs/best-practices.md) - Coding guidelines and patterns

License
-------

[](#license)

The Laravel DDD Starter kit is open-sourced software licensed under the MIT license.

###  Health Score

45

—

FairBetter than 91% of packages

Maintenance94

Actively maintained with recent releases

Popularity10

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity57

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

10

Last Release

32d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/5b097524837116a48c7dcf7439b01ff7e1d1e46587d6e25f21eef71b736966c6?d=identicon)[MMoza](/maintainers/MMoza)

---

Top Contributors

[![MMoza](https://avatars.githubusercontent.com/u/118842323?v=4)](https://github.com/MMoza "MMoza (32 commits)")

###  Code Quality

TestsPHPUnit

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/laravel-ddd-starter/health.svg)

```
[![Health](https://phpackages.com/badges/laravel-ddd-starter/health.svg)](https://phpackages.com/packages/laravel-ddd-starter)
```

###  Alternatives

[laravel/octane

Supercharge your Laravel application's performance.

4.0k24.7M203](/packages/laravel-octane)[unopim/unopim

UnoPim Laravel PIM

10.1k2.2k](/packages/unopim-unopim)[code16/sharp

Laravel Content Management Framework

78762.6k7](/packages/code16-sharp)[nasirkhan/laravel-starter

A CMS like modular Laravel starter project.

1.4k2.7k](/packages/nasirkhan-laravel-starter)[ecotone/laravel

Ecotone for Laravel — CQRS, Event Sourcing, Sagas, Durable Workflows, and Outbox on top of Laravel Queue, via PHP attributes.

21313.7k3](/packages/ecotone-laravel)[codewithdennis/larament

Larament is a time-saving starter kit to quickly launch Laravel 13.x projects. It includes FilamentPHP 5.x pre-installed and configured, along with additional tools and features to streamline your development workflow.

3861.7k](/packages/codewithdennis-larament)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
