Choosing a web framework.
A few years ago, I transitioned primarily to Python for programming and the enhancement of my back-end web development skills. Along the way, I would casually come across things I had previously figured out with PHP and a combination of the front-end languages. As it turns out, many of the libraries and methodologies that are being taught and utilized today are simply new and better ways of doing the same old things. For example, I was making AJAX calls using jQuery before it became basic standard practice to use the fetch API.
As per mdn web docs:
“Unlike XMLHttpRequest that is a callback-based API, Fetch is promise-based and provides a better alternative that can be easily used in service workers. Fetch also integrates advanced HTTP concepts such as CORS and other extensions to HTTP.”
https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch
In hindsight, I was never one to take shortcuts, so I have spent long hours doing things “the long way” when most often there was an easier way. It was a good learning experience, and in updating my skills, I would learn that many advancements have been made in technology to accomplish the same things in a more secure and efficient manner.
I practically built from scratch CMS and e-commerce sites and did so without the use of any web frameworks. Possibly the reason for this was that I learned everything on my own using documentation wherever I could find it at a time that preceded the trend for online courses and video tutorials. Self-taught, with an emphasis on the ‘self’.
My first web framework was Django (or was it Flask?), using Python, and now as I attempt to update my PHP skills I started looking for a good PHP web framework to learn. Many of these names rang a bell, but I was surprised to learn how many are out there. Just a short list of the more popular frameworks:
Web Framework | Initial Release Date | Comments |
CodeIgniter | February 2006 | – Framework with a small footprint, noted for its speed – 1.1MB download, plus 1.6MB for the user guide (epub). |
CakePHP | April 2005 | – Inspired by the popular Ruby on Rails |
Symfony | January 2007 | – Tightly integrated with Doctrine ORM. – “Almost everything can be customized”, very popular – Heavy use of existing open source projects |
Laravel | June 2011 | – Based on Symfony, Eloquent is the ORM – Aimed at being a more advanced version of CodeIgniter. – Built-in support for user authentication and authorization |
All these frameworks are based on the MVC (model-view-controller) development model. Most of them seem to have been initially released around 2005 and they probably didn’t gain much traction until much later. During those years, whenever I wasn’t busy hard-coding, my focus was on a different industry with different full-time responsibilities. So herein was my gap in keeping up with the times.
My decision is: CodeIgniter
Please reserve any judgment as I explain. There are specific factors that went into my decision, and basically it has to do with a project I have in mind. The main consideration is that I will be using shared hosting for this particular site, so I want fast and easy deployment, which means that the code has to be portable and there has to be a shallow learning curve. In short, I want to move my code over from my local environment to my shared webhost provider without having to run any services from the terminal. My understanding is that it will be easier with CodeIgniter.
If all goes well, I would like to move on to Symfony and then Laravel. Perhaps I can skip Symfony and go directly to the more popular and trending framework, but this can be a good path considering that Laravel uses many of Symfony’s components.
Throughout this process, I want to also learn a good ORM in PHP. As far as I can tell, Codeigniter does not seem to come with a full-fledged ORM but it does come with a handy class to connect to and perform basic functions on a database. This should be enough for now, but looking ahead, Doctrine seems like a good ORM to learn. It can be incorporated into Codeigniter, even though it many not be a straightforward process. Doctrine is, however, tightly integrated with Symfony.
The following Youtube video provides a great rundown of several PHP frameworks, which to use and when. It confirmed my intuition of what frameworks to prioritize: https://www.youtube.com/watch?v=-EeriuDAvq8
1 thought on “The Return to PHP Web Development”