HTTP Toolbox

As Web Developers, we need to know how to work with HTTP from every angle. I gave a 2-hour tutorial at PHP UK that included some of my most trusted tools – but it was sold out and a bunch of people asked me if there was video (there wasn’t, tutorials make little sense when videoed). Instead, I thought I’d try to set out a self-study version of the workshop (I rarely teach these days so I’m unlikely to deliver it anywhere else).

There’s a slide deck, some exercises and a sample repo on GitHub … let’s dive in! Continue reading

Using Tags in your OpenAPI Spec

Working with OpenAPI is bringing so many possibilities to the way that developers work with APIs, it’s exciting! The spec is very comprehensive though and I’ve found myself answering questions on individual aspects of it recently, so I thought I’d capture one or two of those things here. Today: tags. Continue reading

Windows removed my grub menu

I know this will happen to me again at a bad moment so I’m putting it here on my blog and hoping I can find it in my future hour of need …

My work machine is a Windows PC, with dual boot to the Ubuntu partition that I actually use. Sometimes, when booting Windows, it “repairs” its disks and removes my grub menu, booting straight into Windows without showing me the grub menu.

To fix this: interrupt the startup, choose the boot device and pick the Ubuntu partition from the list.

Once booted, you can boot-repair to sort out grub – I also travel with a boot disk, just in case!

Ready-to-wear API Collections with OpenAPI and Postman

Have you noticed that API providers are starting to offer “descriptions” of their APIs? These are usually OpenAPI specifications, computer-readable documents that describe every aspect of an API’s endpoints. They can be used to generate documentation, SDKs, but now they can also be used for my favourite API-related activity: poking around! Postman just added a feature to allow importing OpenAPIs and I love it. Continue reading

Test Web Requests with a Local RequestBin

I’ve been a long-time fan of RequestBin, but it’s no longer active since it suffered so much bad traffic. It’s never been too difficult to set up locally and when I tried to do that last week, I realised it has got even easier because it now has a docker-compose configuration. Continue reading

Are you Creating, Curating or Consuming?

I’ve been thinking lately about my own interactions online, especially around content. There are three main ways that I work with content: creating, curating and consuming. Each has their own place but I’ll start by outlining each one.

Creating content is all about putting your own creations out for others to share. I’ve had this blog longer than I care to discuss and certainly since before microblogging was really a thing. It’s much lower investment to throw out a quick tweet about something and in lots of cases it’s a more appropriate medium Continue reading

Generating PHP library code from OpenAPI

I’m working with a bunch of OpenAPI specs now I am working for Nexmo and so far I’m loving working with API descriptions. OpenAPI is the next iteration of what used to be called “Swagger”, a machine-readable way to describe your API and from that description create docs, code libraries, tests, and all sorts. Today’s post is a quick writeup of how I generated some PHP code so that I can refer back to this next time I want to do it! Continue reading

Managing Environment Variables in PHP

Now I work with more programming languages, I start to miss features from other languages when I come “home” to PHP. One that I hadn’t seen in PHP before I saw it in other languages such as NodeJS (I think Ruby had the original implementation) was: a way to easily control setting your environment variables, particularly in development. In NodeJS the dotenv library is great for this; handily in PHP vlucas has already created phpdotenv so we are all set to apply these tricks to PHP applications! Continue reading

Make a POST Request from PHP With Guzzle

I work extensively with APIs and a variety of serverside scripting languages, and best practice does change over time. Many of the most popular posts on this blog are 10 years old, because apparently I was interesting in 2008. Two in particular from around that time relate to making POST requests from PHP … and I’d do it completely differently today. So, in an attempt to overcome some of the past crimes of the Internet in general and PHP in particular: here’s how to make a POST request in PHP, today, in a PHP 7+ world (it probably works in PHP 5 too). Continue reading