DEV Community

Cover image for Haking with Laravel modules

Haking with Laravel modules

Benjamin Delespierre on September 21, 2021

As a project grows it becomes advantageous to break down its monolythical app/ folder into smaller chunks called modules. You know, to keep things ...
Collapse
 
davorminchorov profile image
Davor Minchorov

Interesting idea, I am currently working on my personal website and blog API, and one of the things I am experimenting is something similar to what you've done here, complicating it for educational purposes mainly.

Here's the repository if you want to check it out.

It's in early development but I'll clean things up as I develop it further.

Collapse
 
bdelespierre profile image
Benjamin Delespierre

Hey Davor, thanks for your comment 👍

I see you've restructured Laravel's default folder structure entirely. How does that work for you?

Collapse
 
davorminchorov profile image
Davor Minchorov • Edited

It's been working great in the past when I had to work on a project from scratch and think of something modular like this one. I'll see how it will work in the near future, even though this repository won't grow too much, but I do plan to use these ideas for other side projects as well and see if it will be a good idea or not.

Collapse
 
shealavington profile image
Shea Lavington

Good work! I've been using a laravel-modules package for a while now which works wonders. Registers new commands called php artisan module-make:x Name

Collapse
 
bdelespierre profile image
Benjamin Delespierre

Thanks for your comment 👍

There are a lot of packages like this out there, which one is it?

Collapse
 
saltibarsciai profile image
Saltibarsciai

Will play with it, looks promising, the whole idea of DDD in laravel needs more development. I really like zend's approach and this article reminded me of it

Collapse
 
bdelespierre profile image
Benjamin Delespierre

Hey @saltibarsciai thanks for you comment 👍

Glad you like it. You’ll find some more articles on DDD and Laravel on my page. Don’t forget to follow me to stay updated 😎 and as always, your input & notes are welcome 🙏

Collapse
 
ltsochevdev profile image
Sk1ppeR

Why don't you make a wrapper command to take care of the module syntax though? The way you do it would be gone the moment you upgrade the framework. I'm talking about the artisan file changes.

Collapse
 
bdelespierre profile image
Benjamin Delespierre

Hey @ltsochevdev thanks for your message 👍

I'm not sure artisan updates when you upgrade the framework 🤔 Anyway at this stage it's just a hack. If I see people are interessted, I may make a package out of it.

Collapse
 
victoor profile image
Víctor Falcón

You should make a package with this in order to get this in any project with just a composer require.

I love it!

Collapse
 
bdelespierre profile image
Benjamin Delespierre • Edited

Thanks for your comment 👍

Several other packages 📦 already exists to deal with Laravel modules. I want to see if people are actually interested before investing time and efforts into making another one 😉

Collapse
 
shunmugam profile image
shunmugam

great info, you can use github.com/shunnmugam/laravel-admin

for achieving modular structure with admin feature s

Collapse
 
bdelespierre profile image
Benjamin Delespierre

Thanks for your comment 🙂

Collapse
 
xyluz profile image
Seyi Onifade

This is brilliant! Thank you

Collapse
 
mohammadalavi profile image
Mohammad Alavi

I think this architectural pattern would be interesting to you:
github.com/Mahmoudz/Porto

And there is an implementation of it for Laravel:
github.com/apiato/apiato

Collapse
 
bdelespierre profile image
Benjamin Delespierre

Thanks for your comment Mohamed 👍