Visual Studio Code is hot stuff right now and is quickly becoming the editor of choice for developers worldwide. It’s available for Macs, Windows and Linux and best of all it’s free. These are what I consider the essential Visual Studio Code extensions for PHP developers to improve your productivity.
A PHP question I particularly like to ask candidates at a job interview is to explain a bit of code that includes the
$$ syntax for variable variables. It’s great if the candidate is already familiar with this feature of PHP; but what’s more important to me is that once the candidate understands how this syntax works that they can describe potential issues with using it.
If your development and production environments don’t match you can easily get tripped up when the time comes to deploy to the live server. It’s not too uncommon for developers to find themselves working with one version of PHP and using another in an app or website’s final destination. If you use Composer to manage PHP packages it would be nice to be able to take this into account to avoid any nasty surprises post deployment. Thankfully Composer has this covered.
TravisCI is a great service for running your continuous integration scripts, but when something isn’t working it can be a pain to resolve. One way of testing your script in order to fix it is to install Travis locally using Docker.
A look at using PHP traits with Laravel’s Eloquent models, hooking them up with events and making them configurable.
I’ve released the latest version of my Social Share plugin for CakePHP today.
This is a brief introduction to Unit Testing with PHPUnit and is based on a lightening talk I gave at Sheffield PHP on the 18th January 2018. We’ll take a look at what unit testing and PHPUnit are, why we would use them and finally look at how we can start writing tests.
PHP traits provide a convenient means of sharing methods between classes. There are times though that we may need to override or extend a method defined in a trait attached to a class. Let’s take a look at how we can achieve this.
I’m a keen advocate for following coding standards. They help maintain consistency in code, especially when developing with others, and can generally help you to write better code. I work with Sublime Text for developing in PHP and have it set up to check against whichever coding standard I am currently using as I code. For PHP development the tool to use is PHP CodeSniffer which I’ve previously written about setting up for Sublime Text 3 on this site.
A couple of years ago I wrote about Exporting Data to a Downloadable CSV File with CakePHP which is still getting a lot of interest; however, at the time it was pointed out that a better way of handling CSVs in Cake was using a View Class.
Now that CakePHP 3 is out I thought it would be a good idea to write an updated piece on exporting data to a CSV using the excellent CsvView plugin.