Password Protecting Staging Sites on Laravel Forge Using htpasswd

If you’re using Laravel Forge to host your sites, then you’re probably also using it to host staging sites that are being testing before they go live. It’s usually a good idea to put such sites behind a basic authentication to prevent the likes of Google prying on your pre-production work.

env() Gotcha in Laravel When Caching Configuration

Earlier today I got caught out by an interesting little issue when using env() to access environment configurable values on a deployed Laravel app. Despite having read through the documentation I managed to completely miss the caveat on using this function whilst caching the app’s configuration.

Using Laravel's Bootable Eloquent Traits

A look at using PHP traits with Laravel’s Eloquent models, hooking them up with events and making them configurable.

PHPUnit: What, Why, How?

This is a brief introduction to Unit Testing with PHPUnit and is based on a lightening talk I gave at Sheffield PHP on the 18th January 2018. We’ll take a look at what unit testing and PHPUnit are, why we would use them and finally look at how we can start writing tests.

Laravel Mix Issues Optimising Images in Sass Files

How I solved issues with Laravel Mix’s image optimisation.

Scoping JavaScript Functionality to Specific Pages with Laravel and CakePHP

I regularly work on medium to large scale websites using both Laravel and CakePHP. A common part of the development process is building in some additional JavaScript functionality to improve the user experience. This can often be functionality that is only relevant to specific pages. For a example, on an ecommerce site the checkout process may consist of several steps each with functionality unique to that page; the basket step may need the ability to update quantities and totals whilst the payment screen may need to toggle fields depending on the card type.

Keeping a Vagrant Virtual Box's Time Synced

Whilst working on a site I’ve been developing using a Laravel Homestead Vagrant box I discovered that the box’s clock had drifted out of sync with my laptop by about 10 minutes. Normally this wouldn’t be much of an issue for me, but in my case I was trying to authenticate via an API using OAuth and that time difference was causing the authentication to fail. The solution to my authentication issue was to reset Homestead’s clock to the correct time, but obviously over time this would likely go out of sync again.

Laravel Mix cross-env Issues

The other night I downloaded a fresh install of Laravel 5.4 using Homestead as my development server and quickly hit upon issues running Mix, Laravel’s Webpack API.

Street Art Sheffield

Screenshot of the Street Art Sheffield homepage

Launched a little over a month ago, Street Art Sheffield is a personal project I’ve been working on this year. It’s a showcase for the fantastic street art found across Sheffield, the city I call home.

What's New in Laravel 4.3

Laravel 4.3 is out in November and Martin Bean has nicely summarised what’s new in the next release. 4.3 sees a reworking of the directory structure, name-spacing the default app and introduces “requests” among other things.