Back to blog

How to structure PHP applications

Posted on Wednesday, February 26th, 2014 at 9:42 pm by Ken

Question: A mutual friend recommended that I ask you for some PHP related help. I haven't had a class so I never learned a way to formally structure my files and folders. Is there a program or method that you would recommend to do this?

Answer: There are several ways in which to do this, and many, many frameworks available that can help. If you are looking for an application development framework that allows you to quickly build CRUD (create, read, update, delete) pages for the tables in your database, I've been using the Yii framework for almost 6 months now with great results. If you are looking for a server framework that provides more of an API for a more AJAX-driven front end, I've been looking at the Slim framework. You can use it with various front-end javascript frameworks, such as Backbone.js and Angular.js. Here are various examples:

Backbone.JS with Bootstrap and Slim

Angular JS with Slim

In the end, it depends on the architecture of your application, as well as the subtleties of things like the user interface (e.g., primarily mobile or whatever). Based on your site's needs, such as performance and ease of use, you should probably aim towards a more AJAX-driven app so it works more smoothly and efficiently.

So, take a look at some of the links and see which one makes sense to you and seems to fit the vision for what you want to do. Don't take too long, though; to some extent, you won't really know until you try several of them, and it's best to just get started building your app. Whatever you pick, it will work far better than just a chaotic pile of PHP scripts; I've been there and done that, and it gets very messy very quickly!

Categories: News General