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:
- administrator files (php code and resource files)
- database framework
- resource files (images, templates, including PHP templates, CSS)
- CSS files
- scripts (Javascript and jQuery)
- PHP code (classes, controls)
- PHP and HTML scripts (acting as pages, placed in root)
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:
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.