Drupal 8: Multi-Site Configuration With Configuration Split

2nd December 2018

Setting up a Drupal 8 site for a multi-site environment with a common configuration isn't too hard, it just requires a little bit of forethought and some planning to get things right. You need to have a default configuration in mind, and then think about how each site can override this configuration in different ways. I have seen it done wrong a few times recently and once you go down the wrong path, getting things back in line again can be a difficult.

Creating hook_init In Drupal 8

23rd September 2018

When developing sites in Drupal 7 I found the hook_init() hook was a good way of quickly testing certain things in code. By adding little blocks of code it was possible to build complex SQL queries, inspect internal configuration, or even test complex node interactions.

Drupal 8: Poking A Hole In The Shield Module

25th August 2018

The Shield module prevents access to a Drupal site by putting a Apache authentication system across the entire website. This means that to access the site you need a username and password.

This is useful in a number of different situations, but I use it most for protecting dev and staging sites from access. It's not the most complex authentication system in the world, but it's enough to prevent the embarrassment caused by having staging sites being spidered by search engines.

SOLID Principles In PHP

20th August 2018
SOLID is a set of object oriented design principles aimed at making code more maintainable and flexible. They were coined by Robert "Uncle Bob" Martin in the year 2000 in his paper Design Principles and Design Patterns. The SOLID principles apply to any object oriented language, but I'm going to concentrate on what they mean in a PHP application in this post.

BSides Manchester 2018

18th August 2018
For the second year running I attended BSides Manchester conference, held at the Manchester Metropolitan University Business School on Thursday 16th August. This is a technical cybersecurity conference that is organised by a dedicated team of volunteers. I was really impressed by last years conference so was really keen on attending this year.

Best Practice With Return Types In PHP

23rd July 2018

I've been using PHP for a number of years and have seen the same things being done with return values from functions over and over again. I have always thought of this as pretty standard, but the more I think about it the less it makes sense. Looking back over my career I am quite sure that a few serious bugs could have been avoided if I had not mixed return types.

Color Sorting In PHP: Part 2

Following on from my last post about sorting colors I have been thinking about different ways of sorting colors. I have been looking at interfaces that allow people to select colors and they will quite normally have a band of colors that does look nicely sorted. As it turns out this is perfectly possible to do if the colors are normalised to remove light and dark variations of different colors.

philipnorton42 Sat, 06/23/2018 - 22:03

Bogo Sort In PHP

23rd June 2018

I came across this sorting algorithm the other day called 'bogo sort'. This is a sort of joke sorting algorithm that is highly ineffective at actually sorting arrays. The name comes from the word 'bogus'.

Here is how it works.

An Implementation Of Array Binary Search In PHP

19th June 2018

I have been doing some reading and watching lectures of programming theory recently and I was reminded of this algorithm I learned about in university. Binary searching an array is a divide and conquer algorithm that takes an array and searches for a value in that array by splitting the array into halves. The algorithm works like this.