Programming
Linux, Laravel, PHP. My notes and mini-guides regarding development-related things.
-
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
When 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):
-
Sprinklings of Docker for local development
When I search for docker-related topics online, it almost seems to me that there are two trains of thought for the most part: I believe either of these is a valid approach — whatever feels right to you. Of course it does also depend on how your company / team works. But I’d like to…
-
PHP’s __call magic method and named arguments
Whilst 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?
Consider 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…
-
Giving a flatpak program access to home directory on Linux
List out all of your installed Flatpaks and copy the “Application ID” for the Flatpak you want to give home directory access to. Let’s assume we want to give the program “Insomnia” access to our home directory when it is used. The second column is the Application ID. The application ID for Insomnia is rest.insomnia.Insomnia.…
-
Setting up Elasticsearch and Kibana using Docker for local development
How to set up Kibana and Elasticsearch locally, within Docker containers.
-
Install MongoDB with Docker for local development
Pull the docker image for mongo down to your computer. docker pull mongo Run the mongo container in the background, isolated from the rest of your computer. # Command explained belowdocker run -d -p 27017:27017 –name mongodb mongo -v /data/db:/data/db What I love about this approach is that I don’t start muddying up my computer…
-
-
Bulk converting large PS4 screenshot png images into 1080p jpg’s
A niche example of how I bulk convert my screenshots to make them more website-friendly.