I write bits and pieces for the framework (oh no, another) of PHP, as a learning experience and, hopefully, for future use on small projects.
I did a small part of the reading, namely the Reference documents of existing frameworks. I see the word “Module thrown a lot”, and from my reading and previous experience, a module is a concept used to separate related code (“Views”, “Controllers”, “Models”, etc.).
I am wondering how SO sees a module in this context? (the context is an MVC web application architecture or similar application development pattern)
I am trying to determine how best to apply this, since (I believe) this is consistent with my current predicament. For a music site, the module will look like Artist
, Producer
etc., whereas the controllers will be Profile
, Media
etc. This, of course, will lead to actions, for example View
, or Edit
.
This all seems good, because now I can do this routing:
'Artist/Profile/View/{ALIAS}'
+- Module : Artist
+- Controller : Profile
+- Action : View
//this may be accessed via music.com/artist/{alias}
//defaulting the Controller and Action
.. but I'm trying to understand how the concept of the module fits here, in particular, how I will organize or modify the controllers for placement.
This is the kind of file system location I'm thinking of;
+- Root
+- 'index.php'
+- 'api.php'
+- Modules
| +- Public
| | +- Controllers
| | +- Views
| |
| +- User
| | +- Controllers
| | +- Views
| |
| +- Artist
| | +- Controllers
| | +- Views
| |
| +- Producer
| | +- Controllers
| | +- Views
| |
| +- Venue
| | +- Controllers
| | +- Views
| |
| +- Administrator
| +- Controllers
| +- Views
|
+- Models
+- Config
+- ...