PHPackages                             jafar-albadarneh/laravel-ddd - 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. jafar-albadarneh/laravel-ddd

ActiveLibrary[Framework](/categories/framework)

jafar-albadarneh/laravel-ddd
============================

Scaffold your Laravel services and actions in a Domain-Driven-Design architecture

0.4.0(3y ago)83.8k1[3 PRs](https://github.com/jafar-albadarneh/laravel-ddd/pulls)MITPHPPHP ^8.0|7.4

Since Sep 2Pushed 3y ago1 watchersCompare

[ Source](https://github.com/jafar-albadarneh/laravel-ddd)[ Packagist](https://packagist.org/packages/jafar-albadarneh/laravel-ddd)[ Docs](https://github.com/jafar-albadarneh/laravel-ddd)[ RSS](/packages/jafar-albadarneh-laravel-ddd/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (4)Dependencies (17)Versions (13)Used By (0)

Domain-Driven in Actions
========================

[](#domain-driven-in-actions)

[![Latest Version on Packagist](https://camo.githubusercontent.com/c6cb06e755662aec0132dcd35edbdecb764d1ee49e41d38370274167efaece4b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6a616661722d616c62616461726e65682f6c61726176656c2d6464642e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/jafar-albadarneh/laravel-ddd)[![GitHub Tests Action Status](https://camo.githubusercontent.com/7b079c9018de564cb59967eb3bfe277b7434548bdb4d6cc6a15aa80f21cab39a/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f6a616661722d616c62616461726e65682f6c61726176656c2d6464642f72756e2d74657374733f6c6162656c3d7465737473)](https://github.com/jafar-albadarneh/laravel-ddd/actions?query=workflow%3Arun-tests+branch%3Amain)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/b60bc474937a70645c4707a6af9a9b060f3fde26bbafd6b3ab1b0f3c1e0e8301/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f6a616661722d616c62616461726e65682f6c61726176656c2d6464642f666978253230706870253230636f64652532307374796c652532306973737565733f6c6162656c3d636f64652532307374796c65)](https://github.com/jafar-albadarneh/laravel-ddd/actions?query=workflow%3A%22fix+php+code+style+issues%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/6cce6bfee65a3bf04711bf546aad549539ac07f37c24318cb0e919dbba96aa76/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6a616661722d616c62616461726e65682f6c61726176656c2d6464642e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/jafar-albadarneh/laravel-ddd)

[![](https://camo.githubusercontent.com/83acdfc59fbdc6fad0f77b0ef069af185e316ea42d92b665b37cc9f786b0c049/68747470733a2f2f62616e6e6572732e6265796f6e64636f2e64652f4c61726176656c2532304444442e706e673f7468656d653d6461726b267061636b6167654d616e616765723d636f6d706f7365722b72657175697265267061636b6167654e616d653d6a616661722d616c62616461726e65682532466c61726176656c2d646464267061747465726e3d627269636b57616c6c267374796c653d7374796c655f31266465736372697074696f6e3d446f6d61696e2d44726976656e2d44657369676e2b696e2b416374696f6e732b666f722b4c61726176656c2b4d6f6e6f6c697468266d643d312673686f7757617465726d61726b3d3026666f6e7453697a653d313235707826696d616765733d68747470732533412532462532466c61726176656c2e636f6d253246696d672532466c6f676f6d61726b2e6d696e2e737667)](https://packagist.org/packages/jafar-albadarneh/laravel-ddd)

In a Domain-Driven environment, you would want to keep your code as clean and organized as possible. This package allows to create a domain-driven architecture in your Laravel app. The package assumes the following code structure:

```
- app
    - Domains
        - [DomainA]
            - Actions
            - Events
            - Http
            - Listeners
            - Models
            - Services
```

By design, each domain should be treated in isolation, where all of the actions and services are scoped to the domain.

In regard to inter-domain communication, you can create a proxy service at the domain level to bridge the communication gap between the domains. Internally you're free to either:

- Inject and class services directly
- Follow an internal pub/sub mechanism, where you publish events from (Domain X) and listen to them in other domains \[Domain Y, Domain Z ..etc).

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

[](#installation)

You can install the package via composer:

```
composer require jafar-albadarneh/laravel-ddd
```

Usage
-----

[](#usage)

The package is equipped with a command line tool that allows you to create a domain-driven architecture in your Laravel app. These command line tools include:

### Generating the Domain

[](#generating-the-domain)

After you identify the domain, you can generate it by running the following command:

```
php artisan make:domain [domain-name]
```

The command accepts the following options:

- `[domain-name]`: The name of the domain you want to create.
- `--with-samples=1`: If you want to generate the domain with sample actions and services.

### Generating Domain Services

[](#generating-domain-services)

After creating the domain, you can generate the services by running the following command:

```
php artisan make:service domain=[domain-name]
```

The command accepts the following options:

- `domain=[domain-name]`: The name of the domain you want to generate the services for.
- `--name=[service-name]`: If you want to generate a service with a custom name.

### Generating Domain Actions

[](#generating-domain-actions)

After creating the domain, you can generate the actions by running the following command:

```
php artisan make:action domain=[domain-name] --name=[action-name]
```

The command accepts the following options:

- `domain=[domain-name]`: The name of the domain you want to generate the actions for.
- `--name=[action-name]`: The name of action class within the domain.

### Generating Domain DTOs

[](#generating-domain-dtos)

After creating the domain, settle with your services, you can generate DTOs by running the following command:

```
php artisan make:dto domain=[domain-name] --name=[dto-name]
```

The command accepts the following options:

- `domain=[domain-name]`: The name of the domain you want to generate the DTO for.
- `--name=[dto-name]`: The name of DTO class within the domain.

### Generating Domain DTOs

[](#generating-domain-dtos-1)

After creating the domain, you can generate DTOs to support data streams among your services and actions by running the following command:

```
php artisan make:dto domain=[domain-name] --name=[dto-name]
```

The command accepts the following options:

- `domain=[domain-name]`: The name of the domain you want to generate the actions for.
- `--name=[action-name]`: The name of DTO class within the domain.

### Generating Native Laravel Resources

[](#generating-native-laravel-resources)

You won't be getting the full potential of the package if you can't associate native laravel resources (Controllers, Requests, Resources, Middlewares) with your domain. There are two ways to achieve this:

1- Laravel artisan commands already support passing a namespace to any command. So instead of placing all the resources within the `App\Http` namespace, you can prefix your resource with the **FULL** domain namespace. For example, if you want to create a controller for the `Authentication` domain, you can run the following command:

```
php artisan make:controller \\App\\Domains\\Authentication\\Http\\Controllers\\LoginController
```

2- \[TODO\] The package overrides Laravel artisan commands to support passing a domain name to the command. So instead of passing the full namespace of the domain, you can pass a `--domain=[domain-name]` parameter to your command.

> Note: This feature is not yet implemented.

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits)

- [jafar-albadarneh](https://github.com/jafar-albadarneh)

License
-------

[](#license)

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

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity25

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity49

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

Total

4

Last Release

1211d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/fca6af306e0cba006e55951b876585708d829963ef71470656f5f4d45f90038e?d=identicon)[jafar.albadarneh](/maintainers/jafar.albadarneh)

---

Top Contributors

[![jafar-albadarneh](https://avatars.githubusercontent.com/u/21292175?v=4)](https://github.com/jafar-albadarneh "jafar-albadarneh (45 commits)")

---

Tags

domain-driven-designlaravellaravel-frameworkmonolithlaravellaravel-dddjafar-albadarneh

###  Code Quality

TestsPest

Code StyleLaravel Pint

### Embed Badge

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

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

###  Alternatives

[lunarstorm/laravel-ddd

A Laravel toolkit for Domain Driven Design patterns

17959.0k](/packages/lunarstorm-laravel-ddd)[bezhansalleh/filament-plugin-essentials

A collection of essential traits that streamline Filament plugin development by taking care of the boilerplate, so you can focus on shipping real features faster

27584.7k16](/packages/bezhansalleh-filament-plugin-essentials)[jonpurvis/squeaky

A Laravel Validation Rule to Help Catch Profanity.

706.0k](/packages/jonpurvis-squeaky)[awcodes/filament-addons

A set of components / fields to extend Filament Admin.

3013.1k2](/packages/awcodes-filament-addons)[blendbyte/filament-title-with-slug

TitleWithSlugInput - Easy Permalink Slugs for the FilamentPHP Form Builder (PHP / Laravel / Livewire)

1322.4k3](/packages/blendbyte-filament-title-with-slug)

PHPackages © 2026

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