Support the ongoing development of Laravel.io →
Laravel Views Configuration

I'm wanting to modularize the app I'm building in Laravel so I've created the app/Modules directory. I currently have two modules with many more to come. Each Module has its own views included so I'm wondering if there is a way to register a wildcard path in the view config.

I can manually add each folder but that seems to be more work than necessary.

I've tried using basic wildcard replacement:

app_path('Modules/*/views'),
app_path('Modules/{*}/views'),
app_path('Modules/**/views'),
app_path('Modules/{**}/views'),

But none of these solutions do the trick. If I manually assign the path it serves my views as expected:

app_path('Modules/SomeModule/views'),

Any advice would be greatly appreciated.

Last updated 3 years ago.
0

Update: Found a good how to on modular development in Laravel. Using a service provider, you can set up a boot method that registers all the views directories you plan on using.

http://kamranahmed.info/blog/2015/12/03/creating-a-modular-application-in-laravel/

0

Sign in to participate in this thread!

PHPverse

Your banner here too?

Todd Roper Todd Roper toddroper Joined 26 Jun 2017

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.