PHPackages                             aesircloud/laravel-domains - 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. aesircloud/laravel-domains

ActiveLibrary[Framework](/categories/framework)

aesircloud/laravel-domains
==========================

A Laravel package for rapid domain driven development.

2.0.6(10mo ago)017MITPHPPHP ^8.3CI passing

Since Feb 17Pushed 10mo agoCompare

[ Source](https://github.com/AesirCloud/laravel-domains)[ Packagist](https://packagist.org/packages/aesircloud/laravel-domains)[ Docs](https://github.com/AesirCloud/laravel-domains)[ RSS](/packages/aesircloud-laravel-domains/feed)WikiDiscussions main Synced today

READMEChangelog (10)Dependencies (8)Versions (23)Used By (0)

aesircloud/laravel-domains
==========================

[](#aesircloudlaravel-domains)

---

A Laravel package to scaffold Domain-Driven Design (DDD) structures in your Laravel projects. This package creates a complete suite of files—domain entities, value objects, repositories, domain services, models (with optional soft deletes), factories, observers, policies, and even migrations—so you can quickly get started with a DDD approach.

---

[![](https://camo.githubusercontent.com/b74eb5a180ba6cf2fe33c10a1ab6814075bfd39a325dd8f6db38e40599948478/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6165736972636c6f75642f6c61726176656c2d646f6d61696e732f746573742e796d6c3f6272616e63683d6d61696e267374796c653d666c61742d737175617265)](https://github.com/aesircloud/laravel-domains/actions)[![](https://camo.githubusercontent.com/e2618b84566184eaa4937508415713db64c123d9bd20973b0e12386d502aa4b4/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6165736972636c6f75642f6c61726176656c2d646f6d61696e732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/aesircloud/laravel-domains)[![](https://camo.githubusercontent.com/e7425550274bf4c4427f7fa62e2ead6a0b1828fb642f48f7edf295c8aa4ab9cd/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6165736972636c6f75642f6c61726176656c2d646f6d61696e732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/aesircloud/laravel-domains)[![](https://camo.githubusercontent.com/ed1d00751baf11b11b47e4db5b507a8fa7acc7c001550e1830fbf5763c8e9aff/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6165736972636c6f75642f6c61726176656c2d646f6d61696e732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/aesircloud/laravel-domains)

FEATURES
--------

[](#features)

- **Domain Scaffolding**Automatically creates directories and stub files for a new domain.
- **Model Generation**Generates a domain model extending your BaseModel with optional soft delete support.
- **Factory, Observer, &amp; Policy**Generates a factory, observer, and policy for your domain.
- **Optional Migrations**Create migrations (with or without soft deletes) for your domain’s table.
- **Repository Binding**Automatically updates your RepositoryServiceProvider with the new domain’s repository binding.
- **CRUD Actions**Generates a full set of CRUD actions (Create, Update, Delete, Index, Show) using `aesircloud/laravel-actions`.
- **Optional Soft Delete Actions**When the domain uses soft deletes, additional Restore and ForceDelete actions are generated.
- **Value Object Generation**Use the make:value-object command to scaffold a new value object. Optionally specify a domain to place the value object within that domain’s folder.
- **Interactive Prompts**If a file already exists, you'll be prompted (defaulting to replace) so you can control file overwrites.
- **--force Option**Overwrite existing files without being prompted.
- **Customizable Stubs**Publish the package stubs for customization.

INSTALLATION
------------

[](#installation)

### Install the package via Composer:

[](#install-the-package-via-composer)

```
  composer require aesircloud/laravel-domains
```

Laravel’s package auto-discovery will register the service provider automatically. If you need to manually register it, add the following to your `config/app.php` providers array:

```
AesirCloud\LaravelDomains\Providers\DomainServiceProvider::class,
```

PUBLISHING STUBS
----------------

[](#publishing-stubs)

To customize the stub files used for scaffolding, publish the package stubs:

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

This will copy all stub files into `stubs/laravel-domains` in your project, where you can modify them as you wish.

USAGE
-----

[](#usage)

To scaffold a new domain, run the following command:

```
php artisan make:domain {DomainName} [--migration] [--soft-deletes] [--force]
```

### HOW DOMAIN NAMING WORKS

[](#how-domain-naming-works)

- Class Names: DomainName is automatically converted to StudlyCase.
- Table Names: The table name is derived from your raw domain input, converted to snake\_case and pluralized. Example: php artisan make:domain user\_profile
    - Domain class name: UserProfile
    - Table name: user\_profiles

### BASIC EXAMPLES

[](#basic-examples)

1. Basic Domain Creation

    ```
    php artisan make:domain User
    ```

    Creates domain files under `app/Domains/User/`Generates a User model, factory, observer, policy, DTO, repository interface, and domain service.
2. Domain with Migration

    ```
    php artisan make:domain User --migration
    ```

    Also creates a migration in the `database/migrations` folder.
3. Domain with Soft Deletes

    ```
    php artisan make:domain User --soft-deletes
    ```

    Model, observer, policy, repository, and actions will include soft-delete logic.
4. Domain with Migration and Soft Deletes

    ```
    php artisan make:domain User --migration --soft-deletes
    ```
5. Force Overwrite of Existing Files

    ```
    php artisan make:domain User --force
    ```

    Automatically overwrites any existing files without prompting.

### The command will:

[](#the-command-will)

- Create domain directories (e.g., `app/Domains/User/Entities`, `Repositories`, `DomainServices`).
- Generate stub files for Entity, Repository Interface, and Domain Service.
- Create a BaseModel (if not already present) and a domain-specific model in `app/Models` (using soft delete logic if selected).
- Create a DTO file using spatie/laravel-data in `app/Domains/User/DataTransferObjects`.
- Create a factory in `database/factories`.
- Create an observer in `app/Observers` and a policy in `app/Policies`.
- Optionally generate a migration file (using stubs from `stubs/model`).
- Update the RepositoryServiceProvider with the binding for the new domain’s repository interface and its concrete implementation.
- Generate CRUD actions (Create, Update, Delete, Index, Show), with optional Restore and ForceDelete actions if soft deletes are enabled.

### MAKING A SUBDOMAIN

[](#making-a-subdomain)

To create a subdomain within an existing domain, use the `make:subdomain` command:

```
php artisan make:subdomain {ParentDomain} {SubdomainName} [--migration] [--soft-deletes] [--force]
```

#### EXAMPLES

[](#examples)

Example: Under the 'User' domain, create a 'AuthenticationLogs' subdomain

```
php artisan make:subdomain User AuthenticationLogs --migration --soft-deletes
```

- Also creates actions in app/Actions/{ParentDomain}/{SubdomainName}, e.g. app/Actions/User/AuthenticationLogs/DeleteAuthenticationLogAction.php.
- Binds the repository to RepositoryServiceProvider.

***NOTE:*** The parent domain (e.g. app/Domains/User) must already exist before you can add a subdomain within it.

- You can make a folder in the `app/Domains/` directory to represent a parent domain that you do not need to scaffold. E.g., `app/Domains/HumanResources`. Then you can create subdomains within that folder.
- **Example:** `php artisan make:subdomain HumanResources Payroll --migration --soft-deletes`

### MAKING A VALUE OBJECT

[](#making-a-value-object)

You can also generate a value object, optionally scoping it to a domain:

```
php artisan make:value-object Address
```

Creates a file named AddressValueObject.php in `app/ValueObjects`.

Or specify a domain:

```
php artisan make:value-object Address --domain=User
```

Or specify a domain and subdomain:

```
php and artisan make:value-object Check --domain=HumanResources --sub-domain=Payroll
```

You can also use the `--force` option to overwrite existing files:

```
php artisan make:value-object Address --force
```

REQUIREMENTS
------------

[](#requirements)

- PHP: 8.3 or higher
- Laravel: 11.42 or higher
- illuminate/console: 11.42 or higher
- illuminate/support: 11.42.1 or higher
- spatie/laravel-data: 4.13 or higher
- aesircloud/sluggable: 1.1.0 or higher
- aesircloud/laravel-actions: 1.0.0 or higher

DESIGN AND DEVELOPMENT STANDARDS
--------------------------------

[](#design-and-development-standards)

Please see the [Standards &amp; Pattern Philosophy](STANDARDS.md) file for the design and development standards used in this package.

Security
--------

[](#security)

If you've found a bug regarding security please mail  instead of using the issue tracker.

LICENSE
-------

[](#license)

The MIT License (MIT). Please see [License](LICENSE.md) file for more information.

###  Health Score

35

—

LowBetter than 77% of packages

Maintenance55

Moderate activity, may be stable

Popularity6

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity63

Established project with proven stability

 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 ~10 days

Recently: every ~47 days

Total

20

Last Release

301d ago

Major Versions

0.2.5 → 1.0.02025-02-23

1.0.3 → 2.0.02025-02-28

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/54643782?v=4)[Greg Upton](/maintainers/gregupton)[@gregupton](https://github.com/gregupton)

---

Top Contributors

[![gregupton](https://avatars.githubusercontent.com/u/54643782?v=4)](https://github.com/gregupton "gregupton (44 commits)")

---

Tags

laravelDomain Driven DesigndomainAesirCloudlaravel domains

###  Code Quality

TestsPest

### Embed Badge

![Health badge](/badges/aesircloud-laravel-domains/health.svg)

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

###  Alternatives

[laravel/sail

Docker files for running a basic Laravel application.

1.9k205.7M1.3k](/packages/laravel-sail)[laravel/ai

The official AI SDK for Laravel.

1.0k3.2M195](/packages/laravel-ai)[laravel/mcp

Rapidly build MCP servers for your Laravel applications.

77022.3M151](/packages/laravel-mcp)[laravel/boost

Laravel Boost accelerates AI-assisted development by providing the essential context and structure that AI needs to generate high-quality, Laravel-specific code.

3.5k21.5M596](/packages/laravel-boost)[laravel/surveyor

Static analysis tool for Laravel applications.

86121.4k13](/packages/laravel-surveyor)[api-platform/laravel

API Platform support for Laravel

58171.6k14](/packages/api-platform-laravel)

PHPackages © 2026

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