Skip to content
| Marketplace
Sign in
Visual Studio Code>Snippets>Laravel DDD ArchitectNew to Visual Studio Code? Get it now.
Laravel DDD Architect

Laravel DDD Architect

Shahmy

|
2 installs
| (0) | Free
Enterprise-grade Laravel Domain-Driven Design scaffolding — generate domains, entities, repositories, services, and full DDD structures from the Command Palette or sidebar.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Laravel DDD Architect

Enterprise-grade Domain-Driven Design scaffolding for Laravel — powered by VSCode.

VSCode Marketplace License: MIT


What it does

Laravel DDD Architect is a VSCode extension that automates the creation and management of a Domain-Driven Design (DDD) project structure inside a Laravel application.

It provides:

  • A Command Palette for all generation commands
  • A Sidebar tree view showing all your domains and their layers
  • Artisan delegation when the laravel-ddd-toolkit companion package is installed
  • Atomic filesystem operations — partial failures are always rolled back
  • Built-in generators as a fallback when the toolkit is not installed

Installation

1. Install the VSCode Extension

Search for "Laravel DDD Architect" in the VSCode Extension Marketplace, or install via:

code --install-extension shahmy.laravel-ddd-architect

2. (Recommended) Install the Laravel Companion Package

For the richest experience — including all Artisan commands and publishable stubs — install the toolkit inside your Laravel project:

composer require shahmy/laravel-ddd-toolkit --dev

Then publish the config and stubs:

php artisan vendor:publish --tag=ddd-config
php artisan vendor:publish --tag=ddd-stubs   # optional, for customisation

Quick Start

Initialize a new DDD project

Open a Laravel project in VSCode, then press Ctrl+Shift+P (or Cmd+Shift+P on Mac) and run:

Laravel DDD: Initialize Project

This creates:

src/
└── Shared/
    ├── Application/
    ├── Domain/
    ├── Infrastructure/
    ├── Presentation/
    └── Tests/

And updates composer.json:

"autoload": {
    "psr-4": {
        "App\\": "app/",
        "Src\\": "src/"
    }
}

Create a Domain

Laravel DDD: Create Domain

Enter: Merchant

Generated structure:

src/Merchant/
├── Application/
│   ├── Actions/
│   ├── Commands/
│   ├── DTOs/
│   ├── Events/
│   ├── Exceptions/
│   ├── Interfaces/
│   ├── Jobs/
│   ├── Listeners/
│   ├── Queries/
│   ├── Services/
│   └── UseCases/
├── Domain/
│   ├── Entities/
│   ├── Enums/
│   ├── Events/
│   ├── Exceptions/
│   ├── Repositories/
│   ├── Services/
│   ├── Specifications/
│   ├── Traits/
│   └── ValueObjects/
├── Infrastructure/
│   ├── Cache/
│   ├── Factories/
│   ├── Mappers/
│   ├── Persistence/
│   │   ├── Eloquent/
│   │   ├── Migrations/
│   │   ├── Repositories/
│   │   └── Seeders/
│   ├── Providers/
│   └── Services/
├── Presentation/
│   ├── API/
│   │   ├── Controllers/
│   │   ├── Middleware/
│   │   ├── Requests/
│   │   ├── Resources/
│   │   └── Routes/
│   ├── CLI/
│   └── WEB/
├── Tests/
│   ├── Feature/
│   └── Unit/
├── README.md
└── module.json

Every empty directory contains a .gitkeep automatically.


Commands

All commands are available via the Command Palette (Ctrl+Shift+P):

Command Description
Laravel DDD: Initialize Project Create src/, Shared domain, update composer.json
Laravel DDD: Create Domain Scaffold a full DDD domain
Laravel DDD: Create Entity Create a Domain Entity
Laravel DDD: Create Repository Create Repository interface + Eloquent implementation
Laravel DDD: Create Service Create a Domain Service
Laravel DDD: Create DTO Create a readonly Data Transfer Object
Laravel DDD: Create Action Create a single-responsibility Action
Laravel DDD: Create Use Case Create a Use Case following Clean Architecture
Laravel DDD: Create Event Create a Domain Event
Laravel DDD: Create Value Object Create a Value Object

Artisan Commands (via laravel-ddd-toolkit)

When the companion package is installed, the extension delegates to these Artisan commands:

php artisan ddd:init
php artisan ddd:domain Merchant
php artisan ddd:entity Merchant Product
php artisan ddd:repository Merchant ProductRepository
php artisan ddd:service Merchant PricingService
php artisan ddd:dto Merchant CreateProductDTO
php artisan ddd:action Merchant CreateProductAction
php artisan ddd:usecase Merchant CreateProductUseCase
php artisan ddd:event Merchant ProductCreated
php artisan ddd:value-object Merchant Money
php artisan ddd:enum Merchant OrderStatus
php artisan ddd:policy Merchant OrderPolicy
php artisan ddd:resource Merchant ProductResource
php artisan ddd:request Merchant CreateProductRequest
php artisan ddd:test Merchant ProductTest

All commands support --dry-run (preview) and --force (overwrite) flags.


Configuration

Configure the extension in VSCode Settings (Ctrl+,):

Setting Default Description
laravelDdd.phpPath php Path to the PHP executable
laravelDdd.composerPath composer Path to Composer
laravelDdd.srcDirectory src DDD source directory
laravelDdd.defaultTestFramework pest pest or phpunit
laravelDdd.autoRunDumpAutoload true Auto-run composer dump-autoload
laravelDdd.useArtisanWhenAvailable true Prefer Artisan over built-in generators
laravelDdd.logLevel info debug, info, warn, or error

Customising Stubs

Publish the stubs to your Laravel project to customise the generated PHP templates:

php artisan vendor:publish --tag=ddd-stubs

This copies all stubs to stubs/ddd/ in your project root. The toolkit and extension will automatically use your customised versions.


Architecture

VSCode Extension (TypeScript)

src/
├── shared/          # Types, constants, logger, errors, utilities
├── domain/          # Domain entities, value objects, repository interfaces
├── infrastructure/  # Artisan runner, atomic filesystem, composer updater
├── application/     # Command objects and handlers (use cases)
├── presentation/    # VSCode commands, tree view, status bar, wizards
└── extension.ts     # Composition root — wires all dependencies

Laravel Package (PHP)

packages/laravel-ddd-toolkit/
├── src/
│   ├── Commands/    # 15 Artisan commands (ddd:init, ddd:domain, …)
│   ├── Generators/  # DomainGenerator, ClassGenerator
│   ├── Support/     # AtomicFilesystem, ComposerUpdater, StubEngine, NamespaceGenerator
│   └── DDDServiceProvider.php
├── stubs/           # Publishable PHP stub templates
├── config/ddd.php   # Publishable configuration
└── tests/           # Pest test suite

DDD Principles Enforced

  • Domain layer has zero infrastructure dependencies
  • Application layer orchestrates domain objects through interfaces
  • Infrastructure layer implements domain contracts (repositories, services)
  • Presentation layer handles HTTP — no business logic
  • Cross-domain communication routes through the Shared/ bounded context
  • All generated stubs follow PSR-12, PHP 8.3+ strict typing, and SOLID principles

Contributing

See CONTRIBUTING.md.


License

MIT © shahmy

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2026 Microsoft