I have finished my previous project in yii2. Now, I'm currently working on laravel 5. I am new to laravel 5. I have googled about HMVC in laravel but I haven't found an appropriated answer (ie package) on Laravel. In Yii2 it provided by default .But I have not found in Laravel .Please suggest me How I work moduler way in Laravel 5.
HMVC is a real effective design pattern and has been widely used, however among Laravel's community, this design pattern is considered somehow a “bad practice”. In his book From Apprentice to Artisan, Taylor Otwell – Laravel Framework Author- suggests: HMVC is usually an indicator of poor design.
In CodeIgniter HMVC, HMVC stands for Hierarchical Model View Controller. It is a further new version of the MVC pattern used for web applications. Providing solutions to many problems it helps you solve the scalability of applications.
Module is like a Laravel package, it has some views, controllers or models. This package is supported and tested in Laravel 5+. The nwidart/laravel-modules package is a re-published, re-organised and maintained version of 'pingpong/modules', which isn't been maintained anymore. For more information about this package.
You can achieve this by using namespaces and grouping routes. Look at my screenshot:
As You can see I've 2 top level namespaces: Panel
, Site
.
It's not problem to make controllers with namespace SomeApp
, SomeAnotherApp
and group their routes. using Route::group
.
also read this discussion: https://laracasts.com/discuss/channels/requests/multiple-modules-in-laravel-5?page=1
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With