Looking to hire Laravel developers? Try LaraJobs

laravel-domain-generator maintained by domain

Description
Pacote Laravel para geração automática de estruturas por domínio utilizando DDD, DTOs, Services, Repositories, Controllers e Form Requests
Author
Last update
2026/09/13 18:09 (dev-master)
License
Links
Downloads
164

Comments
comments powered by Disqus

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.

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.