PHP Turns 25

This is fantastic, Jet Brains have compiled a timeline of PHP's first 25 years marking out all the key developments of the language. Looking back over this, it has occurred to me that I have been programming in PHP for about 20 years now.

With PHP 8 expected towards the end of the year, the language is still going strong and is constantly improving. Personally, I am enjoying the direction PHP is going and continue to love coding with it.

How to Fix 'ImagickException: not authorized'

Earlier this week we hit an issue with some code that we use to convert the first page of a PDF document into a thumbnail image (in our case a PNG). We use ImageMagick for the conversion. The code had been working well until we deployed it to a new server and it started to throw ImagickException errors.

An Introduction to Using Salesforce's REST API with PHP

Salesforce is one of the biggest CRM services about. CRM stands for customer relationship management if you didn’t know. It comes with a powerful API that allow us to tap into Salesforce to create, retrieve, update and delete records. In this blog post we’ll take an introductory look at how we can use its REST API with PHP.

Looking Ahead to CakePHP 4.0

Last week the first alpha release of CakePHP 4.0 was made available for testing. This means that the next major version of CakePHP is getting nearer. This is a good opportunity to look ahead at the new and changing functionality of the next version of this PHP framework.

Six Lesser Known Composer Commands You Should Know

Composer is the go to package manager for PHP. If you’re a PHP developer you more than likely use it every day and run the commands require, install and update frequently. What you perhaps don’t realise is that there are a load of other Composer commands at our disposal that can make working with the package manager a lot easier.

There are many commands available, but today I am going to share six that I use and find helpful on daily basis.

How to be PHP 7.3 Ready When Working with Older Versions of PHP

PHP 7.3 was released at the end of last year, but for many of us working with the latest version of PHP is not an option for a while. We are often restricted by the servers that we have to deploy to which can often be a version or two behind.

This means that for many, the new features of PHP 7.3 will remain out of reach for some time. If this describes your situation then this post is for you. We’ll look at four things you can start doing now that will help make it easier to migrate your code to PHP 7.3 when the time finally does arrive.

What are PHP Heredoc & Nowdoc?

With the arrival of PHP 7.3 last month came some interesting changes to the existing heredoc and nowdoc syntaxes. However, not everyone I spoke to even knew that this syntax existed in PHP, so now seems like a good opportunity to take a look at what they are and how to use them.

Setting Negative Numbers to Zero in PHP

A simple little trick in PHP for when you need to make sure that a value doesn’t drop below zero. For example, you might be subtracting a discount from a basket total and not want the amount to be paid to become negative.

env() Gotcha in Laravel When Caching Configuration

Earlier today I got caught out by an interesting little issue when using env() to access environment configurable values on a deployed Laravel app. Despite having read through the documentation I managed to completely miss the caveat on using this function whilst caching the app’s configuration.

Two Ways Using Constants Can Improve Our Code

Constants are named values that do not change. You’ve probably used them many times to set a value that you want to persist throughout your codebase. In this short post I’m going to look at a couple of ways we can use them to improve our code. We’ll look at how they can be used to reduce bugs and make our code more readable.