So far in this series, we have discussed the concept of our applicationselected a cloud technologydiscussed our development environment setup, and looked at test based development. It is now time for us to start looking deeper into our project, and to look at some PHP Frameworks that may assist us in building our application.

What is a PHP Framework?

Simply put, a framework is simply a collection of tools or components that handle many of the standard actions or tasks our application may need to perform. These components could range from authenticating users, to communicating with a database, or providing a navigation interface. PHP Frameworks also tend to encourage a specific design pattern to most effectively utilise its features. It is important to note, that frameworks are designed to assist in developing applications, they are not a mandatory part of PHP development. It is generally advisable to not reinvent the wheel, and to use a tried and tested framework however.

Common Frameworks

There are number of PHP Frameworks available, and there are quite a few that are widely used in the production of large scale web applications. Each have differing feature sets, design principles, and difficulty levels in getting acquainted. Listed below are some of the common PHP Frameworks:

  • Zend Framework
    • Zend Framework is a powerful, fast and extensible framework.
    • Can be difficult for developers not experienced with frameworks or with Zend itself
    • Many believe that the framework is too involved, and too complex for smaller projects.
  • Symfony
    • Symfony has a set of components that can be used independently from the Symfony framework
    • Easier to get started with than Zend, however developers find there is too much configuration required
  • Laravel
    • Laravel is designed to be a rapid development framework
    • Boasts an easy to learn, and easy to read structure
    • Is more lightweight than Zend and Symfony, and in most cases this results in faster performance.

Which Framework to use?

I don’t currently have much experience with established frameworks such as Zend, Symfony and Laravel. With this in mind, I would steer towards Laravel as it is easier to get started with. In the case of our application, I am actually going to develop a simple framework from the ground up. The reason for this, is that this project is a learning experience, and I want to share my experience in working with a custom framework. In the future, I will look at some of the established frameworks, and may post my results for all to see.

What Features Does our Framework Need?

Before we dive into building our framework, what do we want, or need it to do for us? I have developed a list of features that I feel our application will need. This list will likely evolve as our project does, but for now, our feature list looks like:

  • Dependency Injection Management
  • Session Handling
  • Cache Handling
  • Security/Authentication
  • Storage Management (Database, Datastore)
  • User Interface Handling
  • App Configuration
  • Error and Event Logging
  • An MVC Style Design Pattern
  • User Handling
  • Navigation Management
  • User Access/User Role Management

In the following articles, we will look closely at each of these features, and begin building and testing these components. First up is Dependency Injection Management. We will look at defining dependency injection, discussing the reasons we need dependency injection, and then develop our implementation of dependency injection for our application.