Note that there are some explanatory texts on larger screens.

plurals
  1. POFolder structure of a PHP MVC framework... am I doing this right?
    primarykey
    data
    text
    <p>I'm currently working on my own PHP Framework, and I need some help figuring out if I'm going in the right direction or not...</p> <p>The framework is both for my own use and to generally advance my PHP skills further. I've encountered numerous problems that by overcoming them I have learned a great deal, and love being able to create something from nothing, so I'd rather not see answers like "Just use Zend"! ;)</p> <p>I have read a bunch of articles both on Stack Overflow and a bunch of other sites, but can't quite get the right answer I need, so hopefully someone can give me some helpful advice! </p> <p>I've tried a few different solutions, but I've just ended up confusing myself and I'm not sure which direction to go now! Can't quite get my head around it all...</p> <p><strong>'Theoretical' framework structure</strong></p> <pre><code>- .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 </code></pre> <p><strong>Details</strong></p> <ul> <li><em>index.php</em> is the main file, where every request is routed to with <em>.htaccess</em>.</li> <li><em>private/</em> can't be accessed publicly, obviously.</li> <li><em>public/</em> contains all the public files.</li> <li><em>app/</em> contains all app-specific code.</li> <li><em>lib/</em> could contain Zend or another library (I'm also working on my own), to be called with autoloaders</li> <li><em>bootstrap.php</em> is the app-specific code... <strong>Do I need this? is the main 'index.php' enough?</strong>.</li> <li><em>modules/</em> would contain each module... <strong>Do I need modules at all?</strong>.</li> <li><em>default/</em> is the default module that will contain the MVC's for most requests (used when 'admin' isn't the first part of the URL).</li> <li><em>admin/</em> is the module that will contain the MVC's for the admin section.</li> </ul> <p><strong>Anyways, to my question...</strong></p> <p>I thought it would be better to separate the admin section from the rest of the website, but that's where I'm getting stuck. I have made the above structure to work with it, but I'm not sure if this is the most effective way.</p> <p>If a request <em>site.com/videos/view/1/</em> comes to my site..</p> <p><strong>Module</strong>: Default <strong>Controller</strong>: Videos <strong>Action</strong>: View <strong>Params</strong>: array( '1' )</p> <p>and if the request <em>site.com/admin/pages/view/1/</em> comes to my site..</p> <p><strong>Module</strong>: Admin <strong>Controller</strong>: Pages <strong>Action</strong>: View <strong>Params</strong>: array( '1' )</p> <p>Is this the right way to go about this? Or am I over-complicating it and doing something that's not worth doing? </p> <p>Should I have a completely separate application framework for my admin section...? Do I even need to separate the admin section's MVC's from the rest of it all?</p> <p>Sorry for the massive question, just wanted to give you as much info as possible! Feel free to answer whichever part you can =P</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload