PHPackages                             salehhashemi/laravel-domain-expert - 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. salehhashemi/laravel-domain-expert

ActiveLibrary

salehhashemi/laravel-domain-expert
==================================

An intuitive Laravel package to streamline Domain Driven Development by simplifying domain creation, management, and organization within your applications.

v1.4.1(3y ago)40651[1 PRs](https://github.com/salehhashemi1992/laravel-domain-expert/pulls)MITPHPPHP ^8.0CI failing

Since Apr 9Pushed 11mo ago3 watchersCompare

[ Source](https://github.com/salehhashemi1992/laravel-domain-expert)[ Packagist](https://packagist.org/packages/salehhashemi/laravel-domain-expert)[ Docs](https://github.com/salehhashemi1992/laravel-domain-expert)[ RSS](/packages/salehhashemi-laravel-domain-expert/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (5)Versions (13)Used By (0)

Laravel Domain Expert
=====================

[](#laravel-domain-expert)

[![Latest Version on Packagist](https://camo.githubusercontent.com/63d84f99f92c75cfc2af361c66220183819f6315db364cdc6561ae234f08cf92/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f73616c656868617368656d692f6c61726176656c2d646f6d61696e2d6578706572742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/salehhashemi/laravel-domain-expert)[![Total Downloads](https://camo.githubusercontent.com/31a69a734dad319b1d25d1ca7bf40ec0bffab5cfd7e35bfb42c53f1f319046aa/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f73616c656868617368656d692f6c61726176656c2d646f6d61696e2d6578706572742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/salehhashemi/laravel-domain-expert)[![GitHub Actions](https://camo.githubusercontent.com/37289397b1afc170764a00dfb26c12e29e28fa91aab2ad8bcefe6e80225fa3fb/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f73616c656868617368656d69313939322f6c61726176656c2d646f6d61696e2d6578706572742f72756e2d74657374732e796d6c3f6272616e63683d6d6173746572266c6162656c3d7465737473)](https://github.com/salehhashemi1992/laravel-domain-expert/actions/workflows/run-tests.yml)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/57f3cb130f4482964e8ab9d09dd72ba40d237d20eca900745edbc8627a09238a/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f73616c656868617368656d69313939322f6c61726176656c2d646f6d61696e2d6578706572742f6669782d7068702d636f64652d7374796c652d6973737565732e796d6c3f6272616e63683d6d6173746572266c6162656c3d636f64652532307374796c65)](https://github.com/salehhashemi1992/laravel-domain-expert/actions/workflows/fix-php-code-style-issues.yml)[![StyleCI](https://camo.githubusercontent.com/f1a5d654b8645adca181bfe0b4814b0bb55f5a8ff49f7e2e9edd33213394c5d4/68747470733a2f2f6769746875622e7374796c6563692e696f2f7265706f732f3632353636333437352f736869656c643f6272616e63683d6d6173746572)](https://github.styleci.io/repos/625663475?branch=master)

Laravel Domain Expert is a package that helps you create and manage domain-driven directory structures in your Laravel application. It automates the process of setting up a new domain with the necessary folders, a controller, and a simple route file with a route group and a domain prefix.

AI-Powered Domain Recommendation
--------------------------------

[](#ai-powered-domain-recommendation)

Laravel Domain Expert includes an AI-powered domain recommendation feature that helps you automatically group and organize your existing controllers and models into domain-driven structures.

To use this feature, run the following command:

```
php artisan suggest:domains
```

The AI will guess the purpose of your application and provide a well-structured organization without requiring any additional input from the user.

### Sample output of AI system

[](#sample-output-of-ai-system)

[![](./src/sample.jpg)](./src/sample.jpg)

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

[](#installation)

To install Laravel Domain Expert, you can use Composer:

```
composer require salehhashemi/laravel-domain-expert
```

Usage
-----

[](#usage)

### Creating a new domain

[](#creating-a-new-domain)

To create a new domain directory structure, run the following command:

```
php artisan make:domain DomainName
```

Replace DomainName with the desired name for your domain.

The command will create a domain directory structure in your Laravel application, including a sample controller and a simple route file with a route group and a domain prefix.

### Domain Structure

[](#domain-structure)

When you create a new domain using the `php artisan make:domain DomainName` command, the following directory structure will be generated:

```
Domains
└── DomainName
    ├── Exceptions
    ├── Http
    │   ├── Controllers
    │   │   ├── DomainNameController.php
    │   ├── Middleware
    │   └── Requests
    ├── Jobs
    ├── Models
    ├── Observers
    ├── Repositories
    ├── resources
    │   ├── css
    │   ├── js
    │   └── views
    ├── routes
    │   └── web.php
    └── Services
```

This structure helps you organize your code in a domain-driven manner, making it easier to manage and maintain as your application grows.

### Creating controllers within a domain

[](#creating-controllers-within-a-domain)

To create a new controller within a specific domain, use the -d or --domain flag:

```
php artisan make:controller ControllerName -d
```

or

```
php artisan make:controller ControllerName --domain
```

When using the -d or --domain flag, you will be prompted to select the domain you'd like to create the controller in.

### Other commands

[](#other-commands)

You can do the same routine to make:

- observers

```
php artisan make:observer ObserverName --domain
```

- models

```
php artisan make:model ModelName --domain
```

Auto-loading Routes and Views
-----------------------------

[](#auto-loading-routes-and-views)

The package includes built-in support for automatically loading routes and views for each domain. When your package is installed and the service provider is registered, the DomainAutoScanServiceProvider class will scan the Domains directory and automatically discover and load the route and view files for each domain.

### Example: Calling views in controllers

[](#example-calling-views-in-controllers)

To reference a view within a domain, use the domain name as the namespace, followed by two colons and the view file path. Here's an example of how to call a view in a controller:

```
return view('DomainName::view-name');
```

### Testing

[](#testing)

```
composer test
```

### Changelog

[](#changelog)

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

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

[](#contributing)

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

Credits
-------

[](#credits)

- [Saleh Hashemi](https://github.com/salehhashemi1992)
- [All Contributors](../../contributors)

License
-------

[](#license)

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

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance38

Infrequent updates — may be unmaintained

Popularity19

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity57

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

Total

12

Last Release

1122d ago

Major Versions

0.2.0 → v1.0.02023-04-12

PHP version history (2 changes)v0.0.1PHP ^7.4|^8.0

v0.1.0PHP ^8.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/57674418?v=4)[salehhashemi](/maintainers/salehhashemi)[@salehhashemi](https://github.com/salehhashemi)

---

Top Contributors

[![salehhashemi1992](https://avatars.githubusercontent.com/u/81674631?v=4)](https://github.com/salehhashemi1992 "salehhashemi1992 (59 commits)")

---

Tags

aiddddomain-driven-designlaravelopenailaraveldddsalehhashemilaravel-domain-expertdomain-driver-design

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StyleLaravel Pint

Type Coverage Yes

### Embed Badge

![Health badge](/badges/salehhashemi-laravel-domain-expert/health.svg)

```
[![Health](https://phpackages.com/badges/salehhashemi-laravel-domain-expert/health.svg)](https://phpackages.com/packages/salehhashemi-laravel-domain-expert)
```

PHPackages © 2026

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