PHP Google Static Maps

A few years ago I created a wrapper for the Google Static Map API, it never received much fanfare, but it was a fun little project and it was functional. During my last holiday I found a little time to bring the whole thing more inline with what I’ve learnt So with that, it’s been updated and now makes use of: PHP7 syntax Friends of PHP-CS-Fixer PSR-4 Auto-loading PHPUnit tests TravisCI testing/badges »

php-amqplib vs PHP AMQP Extension

##The Problem While testing Futureproofs API performance using BlackFire I noticed that we had a bottleneck centred around an fgets method. It wasn’t part of our code (vague I know, I’ve lost the reference). After a bit of digging I found the culprit in the php-amqlib library; a library we use quite extensively from our API to add messages to RabbitMQ. Now php-amqlib is a great library, we’ve used it a lot and its never once let us down. »

PHP and Upstart

Up until recently I’d been using cron jobs to “kickstart” any failed/exited rabbitMQ consumers. It works, but didn’t come without its own problems, for example: Cron jobs can be no more granular than 1 minute intervals, so if a cron fails, its could take up-to a minute to restart. There is no simple way to terminate/start or restart a process. So I did a bit of googling, I wanted something similar to forever. »

PHP & RabbitMQ Consumer 101 - Part 1

Over at FutureProofs we are in the process of converting one of our existing PDF intensive operations into a process which is triggered by a RabbitMQ consumer. RabbitMQ for those uninitialised is, put simply, a queueing system. You push “messages” onto it and then build consumers to take messages off again. Why would you do this? Why not have a cron job run these? Or simply trigger a process and let the user wait until it finishes? »

Futureproofs API Optimisation

In an attempt to increase the speed of the Futureproofs API, we made several tweaks to the environment and the code, below is a summary of the ones I can remember. Installed Profile Tools I’ve used xdebug for many years, its comprehensive, but quite resource intensive. A few years ago facebook released xhprof, which is a PHP profiler designed to run on live systems (its uses very little resource). Unlike xdebug and cachegrind XHProf doesn’t run across all code automatically, you ‘start’ timing and ‘end’ timing by calling custom functions included in the PECL library. »