I’m convinced that folder/file structure plays an instrumental role in ensuring a downloadable app doesn’t confuse people and is easy to install.
Whilst developing, Bean Counter, the one feature I’ve been most paranoid about is the PHP code quality. I certainly don’t consider myself to be the greatest PHPer in the world and I have this sense of foreboding, that when I finally release this app, the general consensus would be ‘Phil Thompson writes rubbish code’. If this app is successful then its code will be exposed to the criticisms of lots of PHP developers and they can be a cruel and unforgiving bunch.
These past two weeks, I’ve gone some way to ridding that feeling in the pit of my stomach by improving the app’s folder structure by I’ve turning it into a far more MVC-styled system. To be fair, it always was leaning towards MVC (even now it isn’t 100% of the way there) but I feel a lot more confident in it – it’s certainly a lot cleaner to look at.
Bean Counter file structure
- application
- .htaccess
- ajax
- behaviour
- class
- controllers
- images
- inc
- style
- views
- common
- forms
- layout
- site
- .htaccess
- cache
- downloads
- index.php
- local_files.php
You may notice it takes a lot of inspiration from frameworks like Zend, Cake, etc. There is a solid reasoning behind this wholesale thievery; its familiarity should hopefully make developers, who download it, feel more comfortable with the codebase.
The idea behind this app is that it should allow easy updating/editing for people’s individual requirements so modelling it on a conventional MVC structure makes sense.
Some weirdness explained
The images, style and behaviour folders are in the application folder whereas the cache and downloads folder are in the site folder – they should be the other way around (and would be in normal circumstances) but all the beta testing so far been on my server and so by swapping these folders around, from their usual location, has allowed me to share the application folder between multiple installs whilst making sure the cache and downloads folders are unique to each install.
The file local_files.php takes requests for CSS, JavaScript, and images from mod_rewrite and routes them through the application folder’s relevant structure.
What no models folder?
Models live in the class folder. Not all classes relate to models so, yes, I know this is bad form and I should separate them out again but at this stage I think classes that relate to database models and classes that relate to the application’s functionality are best left together.
So when is the release date?
After months of inactivity, I’ve started working on this app again and its currently in another round of beta testing which I hope will only uncover minor bugs. I think I’m quite close to a release date, I have the following things left to do:
- Finish the sales site
- Write help documentation
- Decide whether it’ll be free or not
- Beta test people installing the app locally/on their own servers