Programming related tutorials and step by step guides

Generating OpenGraph images with Netlify On-demand builders

A little while back I built an OpenGraph image generator on AWS Lambda for my Action Spotlight and TIL categories. I toyed with the idea of making them generate the images on demand, but decided …

Pause Laravel queue execution

I’ve been building a new side project that queries the GitHub API a lot; enough that I’m likely to hit my rate limit semi-regularly.

Perform an action on team creation with Laravel Jetstream

In my latest Laravel Jetstream project there are some configuration options that are set on a per-team basis. Initially I edited the Team model to add a static::created method that directly called …

Dedicated test databases with Laravel Sail

I’ve been playing around with Laravel Sail on a project that I’ve just started and wanted to be able to run my tests on a separate database and leave my main DB intact for development.

Follow GitHub Link headers with Bash

When working with the GitHub API, data may be returned across multiple pages of results. This is communicated using a Link header, with rel="next". There are libraries available to help work with …

Semantic versioning for GitHub Actions

There are three ways to use a GitHub action in your projects:

Create a GitHub Action using actions-toolkit

In this post we're going to create a GitHub action that outputs an emoji when triggered by a release. It'll output 🎉 if a release is created, ☠️ if it's deleted and ⚠️ if it's any other action.

Custom content types in Hugo

One of the things that attracted me to Hugo was it's strong custom content type support. It took me a little while to understand that types in Hugo are based on the file structure. If you wanted to …

Creating a new Hugo theme

I've started playing with Hugo this evening and whilst the documentation is pretty good there aren't any step by step instructions for creating a new theme. This is how I did it.

PSR-15 middleware, Zend Expressive and versioning

As it turns out, I mis-remembered what Matthew said in his talk and yesterday's post with Slim isn't actually PSR-15 compatible. Slim currently uses function($request, $response, $next) whilst …

Middleware, Slim and versioning

This morning at #GrumpyConf I watched Matthew Weier O'Phinney give a talk on PSR-15 and middleware and it got me thinking about how useful it can be for transforming API requests and responses …

Speech-to-Text with IBM Watson and PHP

I needed a speech to text engine for a project that I'm working on at Nexmo, and we settled on the IBM Watson speech-to-text engine.

Google OAuth with Node.js

I've been working on an Alexa skill that needed access to my Google Calendar account. The provided quick start is a little tough to follow, so I worked through it and created a minimal example that …

Using an Amazon Dash Button with NodeJS

I finally picked up an Amazon Dash Button to see how they can be used. Here's how to interact with one via node.js.

2FA logins with Laravel and Nexmo

I recently wrote about bootstrapping Laravel with user authentication and how easy it is (seriously, it takes less than 5 minutes). That provides us with a great starting point for our applications, …

SlimPHP and Symfony Dependency Injection

I've been building up a SlimPHP application and learning how it all fits together whilst working with my mentee. This week, the topic of dependency injection came up and I wanted to see if I could …

Bootstrap a new Laravel project with user authentication (in 5 minutes)

We're starting from scratch here, so the first thing we need to do is to create a basic Laravel installation for our project. To to this, run the following command:

ChatOps with Nexmo verify

I'm a huge fan of using Slack to empower my coworkers to perform actions they need but wouldn't normally do themselves. Developers don't need to know what package manager we use, or which supervisor …

Autoloading controllers with Composer in SlimPHP

In the last post, we started using controllers rather than anonymous functions for our routes. In this post, we're going to be moving that controller class out of index.php and in to it's own file.

Using controllers with SlimPHP

Now that we have multiple routes in our application, we have an excuse to start splitting our controller logic out into multiple files.

Using layouts with Twig and SlimPHP

Now that we have Twig integrated, we can start to add multiple routes to our application that all use a common layout. Let's start by creating a layout for our application to use.

Adding Twig to your SlimPHP project

After creating a basic Slim application, the next thing we did was integrate Twig so that we could start creating layouts for our application.

Creating a new SlimPHP application

Whilst working with Martin, I've been using the Slim framework for the first time. I usually reach straight for Silex, so trying a similar (yet different) framework has been an interesting experience.

Customising the AuthController in Laravel Spark

Whilst building up Get Hansel, I wanted to make it possible for people to sign up from the home page. This meant recreating the registration form which was easy enough, but when I sent an actual POST

Selecting a team via the URL in Laravel Spark

Spark is an awesome way to get started writing applications without needing to build in user authentication, team management and payment processing. The application I'm working on at the moment is …

Using var_export to unit test existing code

When writing unit tests, I find that the most time consuming (and the most boring) part of it all is setting up your data providers. Normally I've finished writing the code and verified that it …

alembic - Python migrations quick start

I'm doing all of this in a virtualenv container. You don't need to (but if you don't, you might need to sudo the pip commands). If you're not and you want to, take a look at my virtualenv intro to …

virtualenv and pip - A python environment in 60 seconds

I'm a PHP developer completely new to Python. For this project, I want to make sure that everyone's using the same environment, which means virtualenv and pip. As an added bonus, this means that …

Force flush headers using the HTTP module for NodeJS

Although it's not something that you'll commonly want to do, today I found myself wanting to flush HTTP headers immediately without sending any additional data with them. Internally, NodeJS won't …

Debugging NodeJS Memory Leaks

I recently had the (mis?)fortune of trying to reproduce a memory leak in a NodeJS project I've been working on. I started out by searching for nodejs memory leak and having a read of the tools that …

Sending messages to certain clients with

I recently started playing with and it's really easy to get up and running. Just copy and paste their example and run the server. Open the page and open the console to see your messages …

Using the PHP SDK with Google BigQuery

TL;DR: Google's SDK sucks. Here's how to insert things into BigQuery via Google Cloud Storage. If you want to POST directly into BigQuery, you can't do it using the SDK. More info on that coming …

Behat + Selenium2 / Webdriver with MinkExtension

If you just want the code, you can find it over on GitHub