A few months ago, we talk about the https://dev.to/victoor/repository-pattern-in-laravel-it-s-worth-3mn4 and the reason I don't like it. I found that the default Laravel structure doesn't work with large projects while I was working in my side project, https://get.monse.app.

#table-of-content Table of content #the-problem-with-the-default-folder-structure #the-solution #how-to-implement-this-in-laravel routes events commands factories #the-problem-with-the-default-folder-structure The problem with the default folder structure

You can create a subfolder inside any of this already created folders called Article to split different parts of your application, and you will have something like this: ├── app │ ├── Console │ │ └── Commands │ ├── Contracts │ ├── Events │ │ ├── ArticleCreated.php │ │ ├── ArticleUpdated.php │ │ └── ArticleDeleted.php │ ├── Exceptions │ │ ├── Auth │ │ └── ArticleWithoutValidDate.php │ ├── Http │ │ ├── Controllers │ │ │ ├── PostArticleController.php │ │ │ └── GetArticleController.php │ │ ├── Middleware │ │ ├── Requests │ │ │ ├── PostArticleRequest.php │ │ │ └── GetArticleRequest.php │ │ └── Resources │ │ │ └── ArticleResource.php │ ├── Jobs │ ├── Listeners │ │ ├── SendNotificationOnArticleCreated.php │ │ └── UpdateDashboardStatsOnArticleDeleted.php │ ├── Mail │ │ ├── Auth │ │ └── User │ ├── Models │ │ └── Article.php │ ├── Notifications │ │ └── NewArticleNotification.php │ ├── Policies │ └── Providers ├── database │ ├── factories │ ├── migrations │ └── seeders ├── config ├── routes └── resources ├── js ├── sass └── views ├── mail └── vendor

The idea it's to achieve a folder structure like this: src ├── BankAccount │ ├── Actions │ ├── Http │ ├── Infrastructure │ ├── Policies │ └── BankAccount.php ├── BankConnection │ ├── Actions │ ├── Console │ ├── Events │ ├── Http │ ├── Infrastructure │ ├── Jobs │ ├── Listeners │ ├── Mail │ ├── Notifications │ ├── Policies │ └── BankConnection.php ├── StockOrder │ ├── Actions │ ├── Http │ ├── Infrastructure │ ├── Listeners │ ├── Policies │ ├── Support │ └── StockOrder.php └── UserStockPortfolio ├── Actions ├── Console ├── Http ├── Infrastructure ├── Jobs └── UserStockPortfolio.php
Newsletter

Get the latest Laravel/PHP jobs, events and curated articles straight to your inbox, once a week

Fathom Analytics | Fast, simple and privacy-focused website analytics. Fathom Analytics | Fast, simple and privacy-focused website analytics.
Achieve superior email deliverability with ToastMail! Our AI-driven tool warms up inboxes, monitors reputation, and ensures emails reach their intended destination. Sign up today for a spam-free future. Achieve superior email deliverability with ToastMail! Our AI-driven tool warms up inboxes, monitors reputation, and ensures emails reach their intended destination. Sign up today for a spam-free future.
Community Partners