PHP skills update
In the early 2000’s, when I was most actively doing web development on a freelance basis, I was using PHP for the backend without the help of any web frameworks. I seamlessly ported all my code from my local environment to my shared webhost. It wasn’t until I moved to working in Python that I truly concerned myself with the command line to isolate my different projects and manage each of their dependencies.
Coincidentally, I stopped using PHP regularly sometime between 2005 and 2010. I had already begun to familiarize myself with its object-oriented features, despite improved OOP support just being released in newer versions. It was also a time when many of the popular web frameworks were being released. See my post [The return to PHP web development] . PHP’s Composer, the dependency manager, would not be released until 2012.
Fast-forward a few years and I found that it was time to update my skillset in PHP.
What platform to use (on Windows)?
- Github Codespaces
- Xampp
- Laragon
- VirtualBox
- Docker
I liked the idea of going with Github Codespaces in order to have a fully remote dev environment that I can tap at any time. However, at the time of this writing, Codespaces does not appear to have any PHP templates. And while it may be simple enough to install from the terminal and get everything running, the lack of online documentation suggests that there may be some considerable complications along the way. The lack of information -or my failure to locate it- could also be due to the trendy dislike for PHP, even though it runs a good part of the web.
On second thought, once I dive in, it should not be overly complicated to set up a PHP environment in Codespaces. However, creating separate repos and environments just for my goal of reviewing different frameworks seems cumbersome.
The other option is to develop on my local machine. Since I’m on Windows, a popular option is to use Xampp. I’ve used Xampp (and Wamp) for years and while it is fairly easy to use, it seems to have taken a toll on my computer, in terms of resources, at the time. Although the project is actively maintained and widely used, I had a hard time believing that a newer product hadn’t come out in all this time, for example one that could favor the use of the command line, which is a must for other languages like Python. I would later discover an option that intrigued my interest called Laragon.
VirtualBox and Docker are two other very interesting options. I had to dive a little deeper to learn the differences of these beyond my general knowledge. VirtualBox is good for spinning up different operating systems in a virtual environment. Each virtual machine on the host machine has its own operating system that may be different from the host operating system. However, Docker containers are lightweight because they share the host machine’s operating system and only runs the necessary components in isolation. Docker containers have the advantage that they are portable and can be quickly spun up and down, however, configuration for each project can take some time. While Docker might have a steeper learning curve than other options, these benefits, along with popularity, make it valuable to learn and use.
And the winner is: Laragon
After reviewing the options, I decided to go with Laragon. I needed a lightweight option that wouldn’t weigh down on my aging laptop. I wanted something quick to spin up and configure so that, if I wanted to, I can quickly learn and test out the different PHP frameworks or CMS platforms like Drupal and Joomla, the latter which I toyed with long ago.
Another reason I chose Laragon is because I recently canceled the web hosting account I was using for personal and client projects. Instead of migrating projects to a new web hosting company, the idea of starting with a clean slate is quite appealing. If I ever want to recover an old project, I can do so locally with Laragon.
Laragon installs for you all the tools you need and makes others easy to add. It even comes with PHP’s Composer. Laragon even provides a quick share feature using Ngrok in case you need to share your project with the outside world. (I’ve had to use Ngrok for a separate side project built on Flask in order to test and integrate with a third party product).
It must be said that the official Laragon website does a very good job of selling itself via testimonials, – particularly of users abandoning Xampp -, and linked articles. The product is portable. As per the site: “Laragon has an isolated environment and use built-in service orchestration, so it doesn’t affect your OS.“
One Reddit user considered moving from Laragon to Docker, but described building a dockerfile for each project “a pain in the ass.” So, while I am certainly interested in learning and becoming proficient with Docker, Laragon currently fulfills my needs as I venture back into PHP web development.