PinnedSafely upgrade from PHP 7.4 to 8.1 using RectorI 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…Sep 25, 2022721Sep 25, 2022721
PinnedUpping the coding style game in PHP using RectorRector has a catalog of refactorings ready for us to consume and expand upon.Aug 31, 2022601Aug 31, 2022601
PinnedRefactoring #1: Using ternary and null coalescing operators in PHPUnnecessary long syntax, endless chaining of if conditions, and a redundant nested code. Let’s see how it can be improved.Jul 17, 202154Jul 17, 202154
Upgrading to Laravel 10, PHPUnit 10, and Pest 2We’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…Sep 17, 20231Sep 17, 20231
Speed up GitHub Actions by caching Composer, Rector, & PintGitHub’s 2000 minutes per month of free usage of GitHub Actions is usually enough to handle light workflows. However, as more tech is run…Jun 20, 2023421Jun 20, 2023421
Doing stricter checks in PHPA nice refactoring I’ve learned recently is to utilize types in conditionals.Apr 9, 2023731Apr 9, 2023731
Upgrading to Eloquent accessors & mutators from Laravel 9Laravel 10 is making the headlines these days. However, many apps are stuck in older versions, or at least still use the syntax and methods…Feb 26, 20232Feb 26, 20232
Development Driven Testing, or testing after the fact.As developers, we lose a lot of benefits by testing after the fact.Feb 1, 2023Feb 1, 2023
Allowing users to send emails with their own SMTP settings in Laravel 9We will extend the Laravel framework with very minimal modifications. Using custom SMTP settings is really easy to achieve.Jan 22, 2023Jan 22, 2023
Refactoring #8: What is dead may never runRemoving unreachable and redundant code will benefit you massively over time. There’s a tool to do this automatically for you.Sep 4, 202212Sep 4, 202212
Improve Code Quality in Laravel using RectorThe Rector promise is simple: you install and run the package, you get instant automated upgrades and refactorings.Aug 11, 20221412Aug 11, 20221412
Adding user-specific settings in LaravelThere are many ways to handle this, but the best solution in our case was to use a JSON settings column in our User model.Apr 28, 2022682Apr 28, 2022682
Refactoring #5: From arrays to Data Transfer ObjectsThe problem is simple: our class is returning an array of key-value pairs, and this array is used in quite a few other places in code.Apr 23, 2022271Apr 23, 2022271
Generate monthly chart data with Eloquent & CarbonWe want to display the number of users for each month. How do we account for months that have no data? How performant can it get?Mar 5, 202215Mar 5, 202215
Testingmania #4: Testing Form Requests with PHPUnitPHPUnit allows us to DRY up our tests with Data Providers, which are methods that allow you to execute a single test multiple times, with…Feb 11, 20226Feb 11, 20226
Using Minio to work with S3 buckets locallyCode should behave the same across all development environments. We’re using Minio to unify the experience.Jan 9, 20222Jan 9, 20222
Refactoring #3: Optimizing Eloquent queries & console commandsWe’re refactoring a heavy command in terms of memory consumption, database strain, and execution time, in hopes of having it run daily.Dec 31, 202189Dec 31, 202189
Refactoring #2: From controllers to actionsWe’re extracting some pieces of functionality into their own classes. Their goal is simple: to do one thing, and one thing only.Dec 24, 202121Dec 24, 202121
How to add support for HEIC images with ImageMagick in PHPWe’re adding server support for HEIC images by executing ImageMagick shell scripts. This way, we’re bypassing the GD or Imagick libraries.Nov 11, 202116Nov 11, 202116
Testingmania #3: Testing Fat Laravel Controllers — Pt. 2Going further we’re testing if unauthenticated users can upload photos, whether the images get uploaded to an S3 bucket, and more.Jul 17, 20218Jul 17, 20218