I am currently working on my own PHP Framework and I need help figuring out if I will go in the right direction or not ...
A framework for both my own use and for further promoting my PHP skills. I encountered many problems that, overcoming them, I learned a lot and love to create something out of nothing, so I would rather not see answers like "Just use Zend"!;)
I read a bunch of articles on both Stack Overflow and a bunch of other sites, but I canโt get the right answer that I need, so I hope someone can give me some good advice!
I tried several different solutions, but I just embarrassed myself, and I'm not sure which direction to go now! I can't completely get around all this ...
"Theoretical" structure structure
- .htaccess - index.php - private/ - app/ - bootstrap.php - modules/ - default/ - controllers/ - pages.php - index.php - models/ - views/ - admin/ - controllers/ - models/ - views/ - config/ - config.php - autoloader.php - lib/ - Some_Library - Class1 - class1.php - Class2 - class2.php - public/ - css - images - scripts
More details
- index.php is the main file where each request is redirected using .htaccess.
- private / unavailable in public, obviously.
- public / contains all public files.
- application / contains all application code.
- lib / may contain Zend or another library (I also work independently), for calling with autoloaders
- bootstrap.php is the application code ... Do I need it? is the main "index.php"? .
- modules / will contain each module ... Do I need modules? .
- default / is the default module that will contain MVC for most requests (used when "admin" is not the first part of the URL).
- admin / is the module that will contain the MVC for the admin section.
Anyway, to my question ...
I thought it was better to separate the admin section from the rest of the website, but where I am stuck. I made the above structure to work with it, but I'm not sure if this is the most efficient way.
If site.com/videos/view/1/ .. hits the site.
Module : default Controller : video Action : view Params : array ('1')
and if the request site.com/admin/pages/view/1/ comes to my site ..
Module : Admin Controller : Pages Action : Browse Parameters : Array ('1')
Is this the right way? Or am I complicating this too much and doing something that is not worth doing?
Should I have a completely separate application structure for my admin section ...? Do I even need to separate the MVC partition from the rest of everything?
Sorry for the massive question, I just wanted to give you as much information as possible! Feel free to answer any part you can = P