mardi 20 octobre 2015

Laravel: How to modularize?

I'd like to know something about Laravel 5 which is very important; modularization. In Yii1, all you have to do is run these commands and you are 2/3 done of creating a module:

$ mkdir -p protected/modules/myModule
$ echo "<?php class MyModule extends CWebModule {}" > protected/modules/myModule/MyModuleModule.php

... or something like that. But, it is as simple as that. Just add an entry into the configuration file, and you are good to go.

But how do I integrate the idea of modules into a Laravel app? I saw a few projects on github that suggest themselves to "implement modularization" into Laravel. It seems that Laravel 5 does not support modules. This is...kinda strange. An appearently "ultimative" PHP framework not being able to do modules does seem off.

So I would like to know: What steps, and how many, do I have to do to: - Implement modularization - Use modularization - Automatically place routes to the modules

What I thought I'd do was to utilize PSR-4 and namespaces. This was suggested in one of the modules that were found on Github.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire