Send SMTP Mail from Hetzner Server with Firewall

Laravel Mail Working locally but not on server. Getting stream_socket_client timeout error. We must allow outgoing TCP Connections in Hetzner Firewall....

June 30, 2023 · 3 min · Sam Anglin

How to test protected functions with PHPUnit in your Laravel app

An essential part of developing an app is testing your code. My preferred method of testing my Laravel code is using PHPUnit and this is how I use reflection to test those 'harder to reach' protected and private methods inside classes....

May 13, 2023 · 5 min · Sam Anglin

Undefined type 'Spatie\Permission\Models\' . 'Permission' | 'Role' | 'HasRoles'

VSCode with intelephense throws a strange and hard to debug error when using the spatie/laravel-permissions package even when you follow the docs to the letter. Here is how to fix it....

April 13, 2023 · 2 min · Sam Anglin

Common Function Comparisons in PHP

How do you decide between two functions that, at a glance, seem to do the same thing? Let's pick apart the differences to try and make it easier....

March 4, 2023 · 7 min · Sam Anglin