Peter Coles

Category: Laravel

Disabling Laravel Exception Handling

One of the benefits of Laravel is the way that it sits at your elbow, quietly and effectively taking care of the boring stuff … like whole classes of exceptions – hiding the stack traces away and presenting the consumers of your system with minimal explanations in appropriate formats.

But what about when you, the developer, need to see that detail. For manual browser based testing, not a problem. Set APP_DEBUG=true in your local .env file (which it is by default) and it’s beautifully formatted for you. But nowadays my development is mostly done using Test Driven Development, and all I get to see is the status code to which Laravel has mapped the exception 🙁

Of course the application error log is still there, sitting in the storage folder. But opening and scrolling down that is tedious. Could there be a better way …?

Continue reading

Big Data Seeding Part I – Importing Large Datasets into Laravel

I love Laravel’s data seeding. I use it to create test and sometimes initial production data on every Laravel project that I do. But recently I was presented with a (very) large lump of pre-existing test data.

A bit of background … I was extracting microservices from a monolithic legacy system, and had decided that to minimise risk, I’d maintain data compatibility between old and new systems. With Laravel, this was really easy as Laravel models allow us to define table names and relationships even when they don’t conform to Laravel’s default expectations.

Having an existing, large scale, integration test database looked like a huge benefit, and it was. It would have taken ages to construct this much data from scratch, but thought of translating it to into seeding classes filled me with dread. Happily there’s a much better way of handling this.

Continue reading

Bi-weekly (fortnightly) Scheduling

We have a lot of tasks run to a bewildering schedule across multiple servers. We use cron, of course. But maintaining the schedule is painful. Very painful.

We’ve tried committing copies of the crontab to a repository, but they’re almost never up-to-date.

And worse, if I need to do something even moderately complex like, say, schedule a job to run every two weeks, cron starts to get complicated.

But things just got better.

Continue reading

Copyright © 2019 Peter Coles

Theme by Anders NorenUp ↑