An Empirical Study of Three PHP Frameworks

INTRODUCTION PHP is considered as one of the most popular scripting languages to be used in developing web applications due to the fact that it is dynamic, provides a large amount of flexibility, it’s easy to use and is easy to learn [1]. However, sometimes coding in PHP become a repetitive task. Moreover, the easiness to apply PHP into projects also leads inexperience developers to unorganized code process that they do not even notice. PHP frameworks come into the picture to help developing web application smoother and faster by providing a template basic structure, along with a completed set of built-in APIs, libraries and numerous of extensions (which are developed by framework creators or the community). In other words, frameworks can speed up developing process, cut off developing time, help developers be more productive by reducing repetitive code in the project. The final application created by frameworks will be more stable and secure. In recent years, there are many PHP frameworks for developers to choose from such as Laravel, CakePHP and CodeIgniter etc. In fact, in real world working environment, developers will not write every single line of code while building applications, but instead they use frameworks to optimize their tasks. Therefore, developers should know how to choose the most suitable framework with the best support features to use in their project. For that reason, good understanding of different frameworks become an essential requirement for web developers nowadays. This issue usually ends up with questions like: What is the best framework to use? Or, what are pros and cons of different PHP frameworks? How to know which framework is the most suitable for a project? And many more. For that purpose, this study conducted a series of evaluations and experiments to compare the performance, efficiency and reusability on three selected frameworks that were used in workplaces popularly in 2013 to help web developers understand PHP frameworks and making decisions in selecting PHP frameworks for their projects. [2]. Most comments regarding PHP frameworks are based on the subjective observations and qualitative analysis. Recently, there were a few studies on PHP frameworks evaluations and comparisons. The study of [3] explored the relationship between a framework and the effort it takes to develop a web application. The study of [4] compared and analyzed the impact of data abstraction layer (ORM) on the performance of two PHP frameworks CakePHP and CodeIgniter. The intention of this research was to work out a complete set of measurements for the evaluation of six popular frameworks, which can be further refined into a PHP framework evaluation formal procedure. Ultimately, a guideline for developers in choosing and applying frameworks in their workplace or personal projects will be provided. This paper presents the first phase of the research, where three frameworks were considered, and the measurements were focusing on the performance and reusability. The results should be useful for PHP developers and could be improved in the next phase of the research. By implementing the same token web application using three selected PHP frameworks: CakePHP, Laravel and CodeIgniter respectively, the research provided understanding on how each framework was used in process and the technical details to evaluate the performance of each framework using time measurements for different tasks. The results were analyzed qualitatively. In the rest of this paper, the related research is discussed first, which is followed by the experiment design, data collection and analysis. Finally, the summary and future work are given.

RELATED RESEARCH Five general criteria that developers use to select a framework were indicated by [3]. They are architecture, documentation, community support, flexibility or whether they 1637 possess a list of features. While these criteria are essential, they are not task specific and lack of implementation details. They don’t provide deeper help on making decision for a concrete web application. In [3], a method using source lines of code as a comparative metric to evaluate PHP MVC frameworks and determine the differences in effort required to implement the fundamental components of a web application was developed. According to [4], PHP frameworks can considerably improve the performance of an application. These frameworks usually are based on Model, View, and Controller design pattern. These frameworks provide, different common functionalities and classes in the form of helpers, components, and plug-in to reduce the development time. Due to these features such as robustness, scalability, maintainability and performance, these frameworks are mostly used for web development in PHP, with performance being the most important factor. [4] reported the research on comparing and analyzing the impact of data abstraction layer (ORM) on the performance of CakePHP and CodeIgniter. Load testing and stress testing were used to measure the performance. The results of [4] showed that there is not much of a difference, as per as the performance of CakePHP and CodeIgniter was concerned, with the respect to response time on a live server. CodeIgniter had better performance with respect to throughput on live server. [5] indicated that although PHP dynamic features can give the developers great flexibility, they could have a negative impact on performance. According to [6], database connection is very important for a PHP framework. What happens when multiple parts of your application need to interact with the database? Surely that database-related code shouldn’t need to be duplicated in each and every PHP script. The prudent thing to do would be to refactor all database code into a shared PHP file. A developer should really need to worry about opening and closing database connections. The database-related tasks should be included in the PHP framework evaluation experiments. In software engineering, software metrics are the only tools to control the quality of software [7]. Most of the metrics are developed covering generally programming languages such as C, C++, and Java etc. Some metrics may not be suitable for some programming or scripting languages. There is lack of metric in the literature, which measures the quality of PHP language [7]. In this respect, specific metrics should be developed, and we develop a metric for PHP, which is capable to calculate reusability quality of PHP code. A reusability metric to measure quality of PHP script language (REUphp) was proposed by [7]. Since PHP is an object oriented language, the present metric is capable to evaluate any object-oriented. Software reuse is the process of implementing or updating software systems using existing software components. Reusability of Object Oriented Programming is the use of previous classes or functions or methods in the present class but no problem of previous classes. The goal of Reusability quality of PHP code (REUphp) is to evaluate the current state of the art on the reuse metrics area with special emphasis on code-based metrics. The MVC pattern is a proven and effective way for the generation of organized modular applications. The MVC pattern breaks an application into three modules: model, view and controller. The model module contains the underlying classes whose instances are to be used for manipulating the database, templating frameworks and session management, and they often promote code reuse. All the three PHP frameworks selected for this study implement MVC design pattern.