Firefox PHP

Filesystem structure

Posted by Thomas Seifert 
Filesystem structure
November 22, 2012 07:18AM
As we kinda agreed on an MVC structure for the next major phorum release I'd like to throw in some thoughts about the directory structure.
Personally I like the directory structure as defined by Zend Framework (and most other MVC frameworks to be honest).
Therefore I created a rough directory structure based on that (see attached screenshot).

Any thoughts about it? Are there any downsides like problematic installation on some webhosts with the public_html being alongside the application folder?

Thomas Seifert

Re: Filesystem structure
November 22, 2012 03:48PM
You touched the biggest problem there already. It is not uncommon that you only have the public directory at a hosting provider, making storing files one level higher at least problematic.

The best that we can do here, is making the location of the other directories configurable. In the public directory, there can be a config file for that. There can also be some level of automatic configuration there, by trying to detect the non-public files in some logical locations (e.g. public, public/.. or even /opt/Phorum). This would also make packaged distribution easier to do (allowing a system-wide installation, on which multiple Phorum instances could run).

Of course, I am missing an API directory, but I presume that would be part of the library here ;-)

An interesting bit in directory layout are template resources. The resources must be available over the web, so they either need to be directory available under public, aliased at the webserver configuration level or delivered through a script that proxies the resources from a non-web-enabled directory. That last option was just a joke. Aliasing in the webserver configuration is an option, but it might limit the types of hosting platforms that Phorum can run on. Using webserver-specific features doesn't feel right for a project like Phorum (for company projects, this is different, since then you have a hosting environment that you fully control). So going public with templates seems the way to go based on this.

Maurice Makaay
Phorum Development Team
my blog linkedin profile secret sauce
Re: Filesystem structure
November 23, 2012 03:53AM
Or we could just have an index.php in the main folder (alongside the public / application directories) which handles all the stuff similar to the main index.php in the public folder. htaccess files with the regular rules should be in the application folder(s) anyway.

I'd have a "Phorum" folder in the library folder which should have the API ;).

For the template resources: If we skip the public folder alltogether (doesn't make sense to have it if its used by maybe just 10% of the people) we could have the views folder in the main directory too so that the template resources would be available.
Otherwise I would put them under public/...

Thomas Seifert
Sorry, you do not have permission to post/reply in this forum.