Opinionated, optional project structure for long-term Laravel applications
mehul/laravel-enterprise-structure is a Laravel package for opinionated, optional project structure for long-term laravel applications.
It currently has 4 GitHub stars and 6 downloads on Packagist (latest version v1.1.0).
Install it with composer require mehul/laravel-enterprise-structure.
Discover more Laravel packages by mehul
or browse all Laravel packages to compare alternatives.
Last updated
Opinionated but optional project structure for long-term Laravel applications.
This package provides generators and conventions that guide teams toward maintainable, scalable architecture without modifying Laravel core behavior.
Install via Composer:
composer require mehul/laravel-enterprise-structure
Publish the configuration:
php artisan vendor:publish --tag=enterprise-structure-config
Install the directory structure:
php artisan enterprise:install
This creates the recommended folder structure in your Laravel application.
Generate a new domain with standard structure:
php artisan make:domain User
Creates the domain directory and associated files under app/Domains/User/.
Generate a reusable action for business logic:
php artisan make:action User/CreateUser
Actions contain atomic, single-responsibility operations.
Generate a use case that orchestrates multiple actions:
php artisan make:usecase User/RegisterUser
Use cases bind together actions to achieve specific user workflows.
app/
├── Domains/ # Business logic isolated by domain
│ └── User/
│ ├── Actions/
│ ├── Models/
│ └── Repositories/
├── Application/ # Application-specific logic
│ └── UseCases/
├── Http/ # Controllers stay thin
│ └── Controllers/
└── Providers/
🎯 Laravel remains untouched — No core modifications, only additions
🏗️ Architecture is optional — Use what you need, ignore what you don't
🎭 Controllers stay thin — They route and respond, nothing more
🔒 Domain logic stays isolated — Business rules live in domains, not controllers
🧩 Actions are reusable — Share logic across controllers, commands, and jobs
Customize paths and namespaces in config/enterprise-structure.php:
return [
'paths' => [
'domains' => app_path('Domains'),
'application' => app_path('Application'),
],
'namespaces' => [
'domains' => 'App\\Domains',
'application' => 'App\\Application',
],
];
Run tests with Pest:
npm run test
Run specific test file:
php artisan pest tests/Feature/MakeDomainTest.php
MIT License. See LICENSE for details.
Contributions are welcome! Please submit pull requests with clear descriptions of changes.
See CHANGELOG.md for version history.