Customising API Responses in Laravel 5

Laravel makes it really easy to return a JSON response from the API you're building; you simply return the value from your route or controller action and it will be JSON encoded automatically, ready to be consumed.

Local Composer Packages for Development

New PHP packages are usually developed in parallel with larger projects. However, it's often inconvenient to publish an unfinished package in order to require it as a dependency in your project's composer.json.

Resetting WordPress User/Admin Passwords from the Database

This is a quick and easy one, but I'm bound to forget it somewhere along the way...

Custom Authentication in Laravel with Guards and User Service Providers

Laravel provides a quick and easy way to enable user authentication out of the box through it's AuthManager and guards.

Removing Inaccessible VirtualBox Virtual Machines

This is a quick way to remove inaccessible virtual machines from Virtual Box.

Setting up Error Tracking with Rollbar in Laravel

Error tracking in applications is often overlooked. Sometimes it's difficult to know exactly how to collate and organise your errors until it's too late.

Configuring an OAuth2 Resource Owner Password Credentials Grant with Laravel 5 and oauth2-server-laravel

If you're looking to integrate OAuth2 principles into your Laravel 4/5 application, the oauth2-server-laravel package is a really nice way to do so.

Patching the Bash Shellshock bug on Debian 6 Squeeze

News of the Shellshock bug is spreading fast. If you haven't heard about it already, you should definitely read up on it

Securing Elasticsearch with Nginx

Utilising Elasticsearch is a great way to provide full-text search capabilities to any application through a familiar RESTful interface. However, by default it doesn't come with any way to enforce security...

Using Vagrant and Puppet to build a PHP, Nginx and MySQL environment

I wanted to set up up a local vagrant instance running PHP, Nginx and MySQL that could act as a base environment for other projects I'm working on. These are the steps I took from start to finish.

Pear No Releases Available For Package Pear Php Net

I was recently trying to install PHP CodeSniffer on a machine using PEAR but kept receiving the following error message

Implement JsonSerializable to control how objects are serialised into JSON

I assumed that json_encode would make use of PHP's __toString() magic method, giving me the ability to manage how my object is processed. Turns out it doesn't

Wordpress Infinite Scroll plugin for Origin theme

I've just added infinite scrolling to the blog, with the help of the Infinite-Scroll plugin.

Heroku: Web process failed to bind to $PORT within 60 seconds of launch

Error Heroku Web process failed to bind to $PORT within 60 seconds of launch in nodejs

Preserving numerical array keys while merging

How to preserve numerical array keys when merging two arrays together in PHP

Database Unit Testing with Doctrine 2 and PHPUnit

Settings up Database unit or integration testing with Doctrine 2 ORM and PHPUnit

Get all form values within custom zend validate class

A quick one I recently learned about, Zend_Validate_Interface::isValid allows an optional second argument in addition to the required value parameter

Using Zend Framework as a script

Running Zend Framework as a script can obviously be useful in many circumstances. These are the steps I take to get up and running on the command line.

Problems autoloading Zend view helpers

Case sensitive issues encountered with Zend view helpers on Windows

Checking for duplicate keys in Doctrine

Doctrine doesn't seem to have an inbuilt mechanism for checking for duplicate entries; one solution thrown around the web is to simply try catch the PDOException code 23000.

Filtering by Document ID in Sphinx

How to exclude a certain document ID from within Sphinx and PHP

Filtering by string in Sphinx

Sphinx doesn't support filtering by strings as attributes (yet), so here are two options you can use to get around this limitation.

BlueImp jQuery File Upload in Zend Framework

I came across the popular jQuery File Upload plugin while looking for a simple to use and extensible file upload solution to integrate into a Zend Framework project.

Validate XML with Zend_Form

I needed a simple way to validate user-inputted XML with Zend_Form, so decided to write a simple

Truncating All Tables in Doctrine

A quick script I use to truncate all entities registered in Doctrine

Creating a New Remote Git Repository

When not using GitHub to host your Git repositories, you don't have the luxury of simply cloning once you've created the repository. There are a few extra steps documented here

Overriding Doctrine Types

Sometimes you want to override Doctrine types. For instance, if you have a child project that must adhere to a parent project's Entity Annotations, but you want to use a different class for the Doctrine return value (than the one specified in the parent project), overriding the existing Doctrine type can help.

Multiple instances of Zend_Navigation per Zend_View

I came across an interesting issue recently when attempting to register multiple Zend_Navigation instances to the same view.

Netbeans Obsidian Theme

Having recently switched from Eclipse to Netbeans for various reasons, I have found myself missing the "Obsidian" theme (originally from Notepad++, I believe).

PHPUnit and Doctrine 2 ORM caching issues

I've recently begun setting up test suite for a project I'm working on with PHPUnit. The project is built in Zend Framework and makes use of the Doctrine ORM.

Installing Ruby on Rails on CentOS 5.8

CentOS generally enjoys having out-dated software, such as Ruby 1.8.5. I wanted to get rails running on my VPS to have a play around, which required me to update rubygems and ruby