Search by

domain / laravel-domain-generator

Diegosny

Pacote Laravel para geração automática de estruturas por domínio utilizando DDD, DTOs, Services, Repositories, Controllers e Form Requests

Package info

github.com/Diegosny/laravel-domain-generator

pkg:composer/domain/laravel-domain-generator

Statistics

Installs: 106

Dependents: 0

Suggesters: 0

Stars: 12

Open Issues: 5

v1.3.5 2026-09-11 15:37 UTC

README

Laravel Domain Generator

Laravel Domain Generator

Generate Laravel Domains using DDD and Clean Architecture.

Automate Controllers, DTOs, Services, Repositories, Resources, JWT authentication and public identifiers with a single Artisan command.

Packagist Version

Packagist Downloads

PHP

Laravel

CI Lint

PHPStan

Tests

Docs

CodeQL

Why Laravel Domain Generator?

Building Laravel applications usually means repeating the same boilerplate over and over.

Instead of manually creating Controllers, Services, DTOs, Repositories and wiring everything together, this package generates an organized Domain structure following DDD and Clean Architecture from day one.

php artisan make:domain User

Generated structure:

app/
├── Domain/
│   └── User/
│       ├── DTO/
│       ├── Repositories/
│       └── Service/
├── Http/
│   ├── Controllers/
│   └── Requests/
└── Models/

Features

  • Domain Driven Design structure
  • Clean Architecture
  • Automatic DTO conversion
  • Repository Pattern
  • API Resources
  • Pagination
  • JWT Authentication
  • Public identifiers (ULID, UUID and UUID32)
  • Safe relationship loading (with=)
  • Automatic filtering
  • GitHub Actions
  • Professional VitePress documentation

Quick Start

Install the package:

composer require domain/laravel-domain-generator

Generate the JWT secret:

php artisan jwt:secret

Create your first domain:

php artisan make:domain User

Architecture

The package keeps responsibilities separated.

Controller DTO Service Repository Model
Layer Responsibility
Controller HTTP
FormRequest Validation
DTO Data transport
Service Business rules
Repository Persistence
Model Database
Resource HTTP response

JWT Authentication

Built-in endpoints:

Method Endpoint
POST /api/auth/login
GET /api/auth/me
POST /api/auth/refresh
POST /api/auth/logout

Public Identifiers

The package supports:

Strategy Size Sortable
ULID 26 Yes
UUID 36 No
UUID32 32 No

Example:

GET /api/users/01K2JP6D7N7YF5YJ9W3X1M8Q2R

Quality Gates

This project follows an automated quality pipeline inspired by projects like Laravel, Filament and Spatie.

Pipeline Purpose
CI • Lint Laravel Pint + PSR-4 validation
CI • PHPStan Static analysis
CI • Tests Multi-version testing
Security • Audit Composer vulnerability scan
Security • CodeQL GitHub security analysis
Deploy • VitePress Documentation deployment
Release Automatic semantic releases

Pipeline overview:

Push / PR
    │
    ▼
CI Lint
    │
    ▼
PHPStan
    │
    ▼
Tests
    │
    ▼
Release
    │
    ▼
Deploy Docs

Every push to master automatically:

  • formats the code with Laravel Pint;
  • validates PSR-4 namespaces;
  • runs PHPStan;
  • executes the test suite;
  • performs security analysis;
  • creates a GitHub Release;
  • publishes the documentation.

Documentation

The complete documentation is available at:

https://Diegosny.github.io/laravel-domain-generator

It includes:

  • Installation
  • DDD architecture
  • make:domain
  • DTOs
  • AbstractController
  • AbstractService
  • AbstractRepository
  • JWT
  • Hash (ULID/UUID)
  • Resources
  • Troubleshooting
  • Complete CRUD examples

Roadmap

  • Automatic Resource generation
  • Store/Update DTO generation
  • Domain Events
  • Value Objects
  • Policies
  • Multi-tenancy
  • Cache layer
  • Integration Smoke Tests

Contributing

Contributions are welcome.

Please read:

  • Pull Request Template
  • Issue Templates
  • Coding Standards (Laravel Pint + PHPStan)

before opening a Pull Request.

License

Released under the MIT License.