PHP
-
Don’t stop building
Categories: JournalI really enjoy building scripts for my own workflow. I wish I had the skills to build things in the real world, but until then I’ll keep building stuff in the digital space only. Although I love working with PHP and Laravel, it is Bash that has re-ignited a passion in me to just build…
-
Inventory app — saving inventory items.
Categories: ProgrammingThis is the absolute bare bones minimum implementation for my inventory keeping: saving items to my inventory list. Super simple, but meant only as an example of how I’d work when working on an API. Here are the changes made to my Inventory Manager. Those changes include the test and logic for the initial index…
-
Adding Laravel Jetstream to a fresh Laravel project
I only have this post here as there was a couple of extra steps I made after regular installation, which I wanted to keep a note of. Here are the changes made to my Inventory Manager. Follow the Jetstream Installation guide Firstly I just follow the official installation guide. When it came to running the…
-
Starting a new Laravel 9 project
Whenever I start a new Laravel project, whether that’s a little side-project idea or just having a play, I try to follow the same process. I recently read Steve’s post here on starting your first Laravel 9 Application, so thought I would write down my own setup. Whereas Steve’s guide walks you through the beginnings…
-
Given, When, Then — how I approach Test-driven development in Laravel
Laravel is an incredible PHP framework and the best starting point for pretty much any web-based application (if writing it in PHP, that is). Along with it’s many amazing features, comes a beautiful framework from which to test what you are building. For the longest time I cowered at the idea of writing automated tests…
-
PHP Psalm warning for RouteServiceProvider configureRateLimiting method
Categories: ProgrammingWhen running psalm in a Laravel project, I get the following error by default: This is the default implementation for configureRateLimiting in the RouteServiceProvider class in Laravel: I change it to the following to get psalm to pass (I’ve added named parameters and the static keyword before the callback function):
-
PHP’s __call magic method and named arguments
Categories: ProgrammingWhilst working on a little library recently, I discovered some interesting behavior with PHP’s __call magic method. Specifically around using named arguments in methods that are caught by the __call method. Given the following class: Calling a non-existing method without named parameters would result in the arguments being given to __call as an indexed array:…
-
What is the PHP __call magic method?
Categories: ProgrammingConsider this PHP class: We could call the bar method as follows: However, in PHP, we have the ability to call methods that don’t actually exist on a class. They can instead be caught by a “magic method” named __call, which you can define on your class. So if you instantiated the BazClass above and…
-
Preview Laravel’s migrations with the pretend flag
Here is the command to preview your Laravel migrations without running them: Laravel’s migrations give us the power to easily version control our database schema creations and updates. In a recent task at work, I needed to find out why a particular migration was failing. This is when I discovered the simple but super-useful flag…
-
Categories: Notes
I just successfully submitted my first test-driven package to the PHP packagist repository. It’s just a little Laravel validation rule object for validating a hmac hash against a configurable group of key / value pairs. Am aiming to do a proper write up and possibly even a little video explaining it.
-
Migrating my website to Statamic
Categories: JournalI love Laravel. I also really like WordPress, for what it is. So when it came to originally putting my personal site together I just wanted to get a simple WordPress site together. I have attempted to build my own website and blog in Laravel from scratch multiple times over the years. I even stuck…
-
Updating PHP versions in Ubuntu 20.04
Categories: GuidesInstalling an older PHP version and switching to it in Ubuntu.