PHP Web Application Development Guide

Posted by Darwin Biler on October 27, 2013
  • Use Test-Driven Development as much as possible - Behaviour-driven development is also an emerging practice, Behat and PHPUnit are the best one so far. Test first makes development much easier to maintain and re-factor.
  • Try to decouple the logic from the user-interface by having a RESTful API for you business logic. This way, you can change your user-interface without having to worry about your business logic. It also allows you to centralize the business logic  in one place and use it across multiple sites. For example if you have a website, a mobile site and a mobile app, you can just point all of those apps in your RESTful API instead of developing all the business logic for each app. Restler or Laravel is the best frameworks to use for developing REST API.
  • Try to analyze the different components of your application that performs specific function then make a Composer package for each of those. For example if you have a group of related classes for handling biller payments, you can develop a Composer package that handles billing logic. If the logic of your application is not meant to be published, you can instead create a private repository instead of  publishing it in
  • Make sure you read and understand the PHP coding standards like PSR-0, PSR-1, PSR-2 and PSR-3. This will help you develop easy-to-read codes/libraries and compliant to the standards of the PHP community.
  • Use front-end frameworks like Ember or Backbone.js to organize your Javascript, CSS and HTML codes. This will allow you prevent memory leaks and spaghetti code as you develop your apps.
  • Automate browser-testing by using Selenium. Since it would be very tedious to repeteadly fill up and click buttons and other stuffs in your application manually.
  • You can automate capturing of screencap of your site by using PhantomJS . This will make sure there is no layout messed in other pages of the application when you are trying to experiment with some changes.
  • Make sure you know what SEO and RSS feeds are. Implement this to your pages as much as possible.
  • Refactor your Javascript codes by making them a jQuery Plugin. This will lead into a mantainable and reusable codes. It will also avoid possible conflicts among other codes in the global namespace.
  • If your applications has large volume of read-only requests. Consider putting the data to be served in a NoSQL database like MongoDB or CouchDB. Usually, you should have all your INSERT/UPDATE/DELETE  in relational database like MySQL then cleanse/sanitize it, move it to NoSQL database and let the read-operations go in NoSQL database. This will avoid your MySQL database from getting overloaded. NoSQL database as well can be distributed and load-balanced easily compare to relational databases.
  • If you have created a  REST API for your application, make sure you make a documentation of it using Swagger
  • Make your application easy to use by developing a Google Chrome browser Extension for it.
  • If the application you are developing is a part of larger system. Consider using Directory Services and LDAP  instead of making users database table. This will make it easier for the organization to manage the user's credential of your application. It will also provide Single-Sign-On to end-users which will make it easier for them to use your app.
  • Start coding your front-end by using well-tested CSS frameworks like Twitter Bootstrap
  • Use Laravel Framework as much as possible to start a new project. It is by far the best framework out there.
  • Use cloud-computing as much as possible to host your application. Amazon Web Services and Windows Azure is one of the best out there.
  • If you are trying to put up a small business online. Consider enrolling to Microsoft BizSpark. You could get financial and connection boost from there, not to mention the free hosting and software that you could use for your startup.
  • If your application needs to analyze and process huge amount of spatial and geographic data, consider using ArcGIS.