Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

_fag's avatar
Level 11

How to structure a large Laravel project?

Following best practices, what would be the most appropriate way to organize the structure of a large Laravel project?

0 likes
9 replies
Sinnbeck's avatar

What is large? How many devs will be working on it from day 1? 500?

_fag's avatar
Level 11

@Sinnbeck Large in the sense of code complexity. For example, when having an abundance of code in a controller, we create a service class.

martinbean's avatar

@daniel.fagundes Stick to the framework’s conventions.

The projects I’ve seen fall apart in almost 10 years of working with Laravel are the projects where someone’s decided their project is a special little snowflake, unlike any other project written in Laravel, and therefore needs a special “modular” directory structure or DDD-like architecture.

The developers start out with good intentions, but it then slowly falls apart as different developers interpret things differently and the project ends up as a big ball of mood and decide they need to embark on The Great Rewrite™.

1 like
_fag's avatar
Level 11

@martinbean This is the kind of catastrophe I want to avoid. Following structure conventions seems like good advice, so you have any article that you recommend for me to learn these conventions?

martinbean's avatar

@daniel.fagundes There’s nothing to “learn”. You create a Laravel project. You keep putting files in folders that Laravel puts them in: controllers in app/Http/Controllers etc.

1 like
matthewknill's avatar

@martinbean does this mean that we should also avoid using packages such as: https://github.com/nWidart/laravel-modules.

I already have a large CRM project that I also want to add a billing component to - in essence, merging two large projects in to one. These two projects have many overlaps (i.e. customer data etc.) so would I be better just having some sub folders in the Controllers and Models etc. for grouping purposes?

motinska94's avatar

I have nothing much to add to other comments in the structuring part, but I'm also tackling a huge project on my own (literally, from logo to back end, all me) and I just wanted to wish you good luck in your project.

Especially if you're working on the project solo, I'd recommend you to structure your work plan rather than your code base, both is important but keeping your schedule clean and consistent is way more important. Having a notebook with a todo list is the one thing that helped me the most in my development, it still does. For some reason I set up and forget about my trello page, but that notepad keeps me responsible. It also keeps me from burning out because I always know what I'm supposed to do next.

As a side note, you can look up SOLID principles and write your code according to those principles. It makes everything so clean and to the point.

1 like
PovilasKorop's avatar

It's really hard to answer in a forum reply, it delends on the project and on the preference of your own team or yourself, what structure you're comfortable with.

I discuss potential options and examples in my 2-hour video course.

It would be more beneficial if you ask more specific questions, like "Where should I put X feature code" or similar. And even then you would probably get "It depends" answer or personal preference.

2 likes

Please or to participate in this conversation.