I'm trying to organize a larger PHP project with more than 50 files in code, not counting the resource files.
It looks like this:
How does one, properly organize a larger PHP project like this one?
First of all, a project that holds 50 files is not even called a project, in the real concept of the word.
Take a look at how the most used frameworks do that and you will get a place to start.
Some PHP frameworks:
So you can have a good reference, there is a simple good practice on PHP projects that tells that only the template, stylesheet and scripts files should be in a public directory, such as /var/www on your host. All the core application should be on a higher-level structure, for example:
src/ (The core application)
public/ (The public directory)
css/
img/
js/
index.php
You can, then, have a .htaccess file on the public directory as well, so you can control the requests.
But again, project architecture and structure organization goes a lot further than those simple tips.
As it was already pointed out: you should separate the publicly available files ( css, images, flash, fonts and application entry points ) in one directory , and the rest of application - in another.
I think more important is the structure with the application itself.
But this will depend on your personal preferences.
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