RSSAmplifier

Blog

Geni Jaho | Laravel Developer

Hey, I'm Geni, a full-stack web developer with a passion for testing, refactoring, and programming best practices.

blog.genijaho.devRSS feed ↗12 posts

Latest posts

Simplifying work with custom stubs in Laravel

Testing is almost always difficult when developing applications that interact with external services, APIs, or complex features. One way to make testing easier is to use stub classes. Here's how I usually work with them. Quick intro on benefits Stubs...

Upgrading to Laravel 10, PHPUnit 10, and Pest 2

We're upgrading from Laravel 9 to 10, and PHPUnit 9 to 10, and, if all goes well, we'll top it off by migrating to Pest, the latest version. To keep the positive vibes on I'll skip an upgrade from PHP 8.1 to 8.2, just because I don't want to restart ...

Speed up GitHub Actions by caching Composer, Rector, & Pint

GitHub's 2000 minutes per month of free usage of GitHub Actions is usually enough to handle light workflows. However, as more tech is run automatically, we are forced to upgrade to a paid plan or optimize our workflows. Currently, I am running Rector...

Doing stricter checks in PHP

A nice refactoring I've learned recently is to utilize types in conditionals. For years I’ve been doing if (!empty($posts)), but Rector, a tool to automatically refactor code, changed that to if ($posts === []). The main advantage of using $posts ===...

Upgrading to Eloquent accessors & mutators from Laravel 9

Laravel 10 is making the headlines these days. However, many apps are stuck in older versions, or at least still use the syntax and methods of older releases. One of the most significant changes introduced in Laravel 9 is the syntax for accessors and...

Development Driven Testing

One of the first roles that I've been working on since I went full-time remote was that of the unit tester. I wasn't used to being the QA guy before and although this was new to me, I've gotten the hang of it. However, as part of my role, I had to wr...

Allowing users to send emails with their own SMTP settings in Laravel 9

Various guides exist on how to do this in Laravel, but all the ones I found (this and this) worked only up to Laravel 8. The reason is that in v9 the Swift Mailer was no longer supported in favor of Symfony Mailer. The Laravel docs show how to write ...

Safely upgrade from PHP 7.4 to 8.1 using Rector

I have to say it from the start, the only thing that comes close to safely upgrading a codebase is having a solid set of automated tests. Nothing gives you more comfort than a bunch of green checkmarks dancing on the screen. With that said, we're goi...

Refactoring #8: What is dead may never run

It's important to take a good look at your code and clean up when you're done with it. Once in a while, we tend to forget this little detail and just move on, leaving behind trails of unreachable statements. Here's a very blatant example of a dead pi...

Refactoring #7: Upping the coding style game in PHP using Rector

Continuing from the last post, we're now exploring other Rector configurations that help us improve our code. It's funny actually, Rector is a refactoring tool, but I'd be lying if I didn't use it to learn a good practice or two. Really, they have a ...

Refactoring #6: Improve Code Quality in Laravel using Rector

I recently discovered Rector and was completely blown away by its power and effectiveness. The promise is simple: you install and run the package, you get instant automated upgrades and refactorings. Damn, that's bold, I thought as I dry ran it into ...

How to add support for HEIC images with ImageMagick in PHP

Apple released a new image format called HEIC/HEIF, and it broke many apps that handle image processing. The PHP library Intervention Image caught up to it and added support for the new image format, but somehow, it isn't working at the time of this ...