Leveraging PHP Frameworks for Your SMB Projects

Paul Mah

Packt Publishing recently sent me a new book written by Samisa Abeysinghe titled "PHP Team Development." In a nutshell, the book explores how team leaders and IT managers can use Model View Controller (MVC) strategies to divide complex PHP projects into simple sub-parts that multiple team members can work on. Agile development, source control, testing and bug tracking also are covered, among other related topics.


While this is a little more involved -- and technical -- than what we typically cover here, the chapter that talked about various PHP frameworks caught my interest. Given the interest and e-mails I received when we last looked into the advantages and disadvantages of Web development using PHP, I reckon that this is an area worth exploring.


Why bother with Frameworks?

I think that it would be a huge mistake to dismiss the use of a PHP framework as a purely technical decision left solely to the programmers. This is especially so in the context of smaller SMBs where limited manpower and resources might mean hardship down the road should a project start off with an unsuitable framework.


And unless an SMB opts to buy a turn-key solution, the use of a framework is unavoidable as a means to reduce project complexity and speed up development. In fact, it's likely that some form of framework is used even with a turn-key solution. In addition, knowing the framework for an off-the-shelf PHP product can help you better understand its limitations.


As such, it makes sense to learn more about frameworks as opposed to treating them as a separate and insignificant topic. Before we look at some of the considerations highlighted in the book when choosing a suitable framework though, let us first establish some of the advantages that a framework can bring to a PHP development project.


Advantages of using a Framework

There are really a plethora of reasons to implement some form of framework as part of your SMB's PHP development project. In my opinion, they are key reasons:


  • Simple to use -- Using a framework allows for easier development, precisely because this is what they were designed to do. For one, because key actions or functionalities are often packaged into precise function calls or method invocations, it becomes much easier make sense of code written by team members. Assuming familiarity with the framework being used, new team members or external contractors also will find it easy to make changes or perform code audits. In addition, the presence of duplicate code can be greatly reduced or eliminated.
  • Encourages code quality -- The use of a framework enhances code quality for various reasons. The volume of code that needs to be written is greatly reduced. Assuming a robust framework in the first place, this has the added effect of reducing the amount of testing required, minimizing the introduction of inevitable human errors. In many instances, there are frameworks that actually enforce a rigid pattern or structure, which helps eliminate any arguments or inevitable lapses when it comes to coding styles. When done across the entire project, this encourages code consistency, which is an important to improve quality.
  • Separation of HTML from PHP -- There is always the temptation for programmers, especially novice ones, to incorporate PHP code into the HTML display layer. However, this is undesirable for many reasons. To combat this, frameworks generally come with various strategies to deal with the separation of HTML from PHP code. Regardless of the methods used, the outcome is often the same: It is not possible in most cases to sneak PHP code into the presentation layer. This results in a more robust and easily maintained site in the long term.


In my next blog, I shall take a look at some considerations when searching for an appropriate PHP framework for your SMB. Stay tuned.

Add Comment      Leave a comment on this blog post

Post a comment





(Maximum characters: 1200). You have 1200 characters left.



Subscribe to our Newsletters

Sign up now and get the best business technology insights direct to your inbox.