PHP 7.4 New Features

PHP 7.4 comes with a few new features that can help improve performance and make for cleaner code. Here's some of the new features that come with PHP 7.4.

Formatting Exception Messages

Learning about how you can format exception message classes.

Composer Scripts

In this tutorial we're going to investigate how you can store common commands within composer, giving you some handy shortcuts.

How To Mock Classes In PHP

In this tutorial we're going to learn when and how you will mock a classes in your php tests.

Organising PHP Exception Classes

In this tutorial we're going to investigate how we can organise PHP exception classes better in PHP. In PHP you have a lot of options for exception classes each allow you to catch different error stat...

Shorthand Comparisons In PHP

In this tutorial we're going to investigate how we can improve our code by cleaning up unnecessary code by using shorthand code samples in PHP. So what do I mean by removing unnecessary code? The most...

PHP7 Array Iteration Trick

In this tutorial we're going to look into a look tip for dealing with PHP array iterations with PHP 7. When you're developing in PHP and need to iterate over an array you'll probably see something lik...

How To Install xdebug on PHP 7.1

Xdebug is a very useful tool when it comes to PHP development, it's a PHP extension that allows you to profile and debug your PHP code. It even allows you to step through your code during runtime to s...

Increment Numeric Part Of String

Have you ever needed to increment the number which is part of a string. For example if you have an invoice number with the format und001 and want to be able to automatically create the next invoice nu...

Get Keyword Frequency In PHP

In this tutorial we're going to find out how we can get the keyword frequency from a string or even a webpage in PHP. This information is useful when you're trying to work out the SEO of a page so you...

Return Class Constant From Variable

PHP constant values allow you to set a variable on the class which will remain the same and is unchangeable. The difference between these constants and other variables in a class is that they are not...

Preserve Variables Between Unit Tests

Although not strictly unit testing but more functional testing I've been in the situation where I've had to perform automated tests of database interactions. This could be by using a process of creati...

Environment Specific Doctrine Datafixtures

When working on a Symfony project the database you will most likely be working with is doctrine. A bundle used on doctrine you can use in your projects is called data fixtures. Data fixtures are used...

Setting Doctrine Object From ID

In a recent Symfony project I was using Doctrine as the database interface. Doctrine is a set of PHP class libraries that are focused on database storage and database management. The main projects wit...

Doctrine Date Modified On Update

Doctrine is a set of PHP class libraries that are focused on database storage and database management. The main projects with Doctrine are the ORM (Object Relational Manager) and DBAL (Database Abstra...