Verifying Laravel Version Compatibility
/ 3 min read
I’ve been working with Honeybadger to build a new set of PHP integrations. I would like to write more about that soon, however, I feel like I’ve stumbled across something that could be useful to others. I wanted to share it as soon as I could.
For the Laravel package, I was aiming for Laravel 5.5 and newer support as it is the latest LTS version. I feel like it makes sense to support down to LTS unless it becomes too complex to do so or you are leveraging features that just don’t exist in the older versions.
In hindsight, I don’t think that I actually ever tested it against a 5.5 install. I relied on the CI process to make those verifications for me. I use orchestra/testbench to aid in the testing workflow. I scaffolded the project with spatie/skeleton-php. The Travis configuration I was using seemed to work well but in hindsight, I think it really only works well if you are supporting a single version of Laravel.
As Laravel 5.7 is now out, I needed to add support to both the package’s composer configuration and verification in CI. Previously, I only needed to verify against 5.5 and 5.6 I thought that having --prefer-lowest
in the matrix would add the coverage I needed. Now that I am supporting three versions I felt that I needed a more specific way of verifying compatibility with different versions of Laravel.
I poked around to see what some other packages were doing and this is what I ended up putting together.
Unexpectedly, this caught some issues with Laravel 5.5 support in the core honeybadger-io/honeybadger-php library.
After updating some version constraints in that package I was able to get everything dialed in. Additionally, I spun up a Laravel 5.5 application locally and tested it for sanity’s sake for both positive and negative test cases. This ensured that the CI process was correctly passing and most importantly, failing when expected.
https://travis-ci.org/honeybadger-io/honeybadger-laravel/builds/428437160
I feel pretty confident in this solution and set of verifications now.
Check out the Honeybadger libraries: