I 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…
This 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…
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…
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…
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…
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):
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:…
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…
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…
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.
I 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…
Installing an older PHP version and switching to it in Ubuntu.
Finally got my site to use the roots wordpress structure. Composer dependency management and deployment with laravel forge. 🤓
In Laravel you can create custom request classes where you can house the validation for any given route. If that validation then fails, Laravel’s default action is to redirect the visitor back to the previous page. This is commonly used for when a form is submitted incorrectly – The visitor will be redirected back to…
Laravel’s blade view compiler is second to none. I’ve used a couple of different templating engines and blade is by far my favourite. Including Partials The way in which we include partials of views within our main views is as follows:@include(‘partials.my-first-partial’)It will inject that partial’s content in the specified place. Defining Sections Within our views,…
A handy way to have some of your routes skip the middleware for CSRF protection. Handy in some situations.