Every two weeks I send out a newsletter containing lots of interesting stuff for the modern PHP developer. You can expect quick tips, links to interesting tutorials, opinions and packages. Want to learn the cool stuff? Then sign up now!

Theme-based views in Laravel using vendor namespaces

At Spatie, we’re building a multi-tenant app. Seb figured out a great way to handle theme based views.

Laravel allows you register a view vendor namespace which points to a specific directory containing Blade files. This feature is intended for package development, but it’s a perfect solution to our problem.

By registering a namespace with the current theme’s location, we can drop all the dynamic parts of our view names when we’re calling them.

https://sebastiandedeyne.com/posts/2017/theme-based-views-in-laravel-using-vendor-namespaces

Freek Van der Herten is a partner and developer at Spatie, an Antwerp based company that specializes in creating web apps with Laravel. After hours he writes about modern PHP and Laravel on this blog. When not coding he’s probably rehearsing with his kraut rock band. He loves waffles and butterflies.