Baking a Cake and Programming?
Baking a Cake and Programming?

In college, I had mostly done projects in Java. My internship project was also Java-based. Then I got a job as a PHP developer and I started working in core PHP.  In Java, I knew a few frameworks but I had not used any framework in PHP, so I decided to learn Codeigniter in my free time. I went through a few tutorials and tried it out.

Later, when I joined OPSPL, I was asked to learn CakePHP. Both Codeigniter and CakePHP are MVC based frameworks. Since I was learning Codeigniter, it was easy for me to understand CakePHP too. CakePHP has a different directory structure from Codeigniter but the basic workflow is the same.

I started going through various tutorials, and I came across the first and very cool feature of CakePHP; code generation with bake commands. I just created a database table and by executing bake commands, I was able to create a full application structure. CakePHP automatically created the controller, model and view files with fully functional code to perform CRUD operations. Also, all the pages were styled using CSS and had a navigation menu on the left-hand side. All forms were validated using CakePHP’s validation. This kind of code generation is not possible in Codeigniter.

Templates and layouts help to implement the header and footer easily. These along with the main content of the page are stored individually. The layout combines them all and displays it to the users. This helps in projects where we want to show different layouts to different types of users.

CakePHP facilitates easy migration of database structure when moving a site from one location to another. The table structures are defined in migration files. Using these files, tables can be generated on the new server.

Another good thing that I like about CakePHP is that it has built-in functions to authenticate and authorize users. In Codeigniter, we have to write our own logic to authenticate users.

Both frameworks are powerful and help you develop web applications faster. Although they are similar in many ways, I found Codeigniter little easier to understand as compared to CakePHP. CakePHP is lightweight and provides better functionality. It is also the better choice for large applications.

Varsha Sahakari

Post Comments

* marked fields are mandatory.