Stay up to date with all things Laravel, Tailwind, WordPress & PHP

How to test Laravel notification e-mail contents

Published November 16, 2021; last updated on November 29, 2021
How to test Laravel notification e-mail contents

In this tutorial I’ll show you how to test the content of notifications in Laravel. This is particularly handy for testing whether certain data (like a confirmation number or certain credentials) is visible in the notification, similar to how you test ‘regular’ view.

For this tutorial I’ll assume you already know how to make notifications in Laravel.

How test whether a Laravel notification has been sent

First, let’s start with a simple example of testing whether a notification with subscription information was sent to a user.

Test how many times a Laravel Notification was sent

Published November 2, 2021
Test how many times a Laravel Notification was sent

Until a few months ago I barely did any automated testing on the code I wrote. That changed after I encountered the concept dubbed ‘TDD’. Sounds scary, but really isn’t. It stands for Test-Driven Development and it basically means that you write an automated test before you actually implement the feature.

The advantage of this is that you don’t need to do so much manual testing as before (you can now run a simple command to check whether the test already passes) ánd you’ve got good test coverage when you’re ready.

How to keep Laravel Horizon active with a cron job (New package)

Published October 15, 2021
How to keep Laravel Horizon active with a cron job (New package)

Laravel Horizon is a great tool for managing and monitoring your Redis queues in Laravel. It allows you to spin up queues fast and make use of all the awesome Laravel Queue features.

However, there’s one downside to Laravel Horizon. That downside is that Laravel Horizon does not restart the queues automatically if the process was terminated for some or the other reason.

Consider the scenario that you have a queue running,

Laravel Eloquent relationships for beginners – Full 2021 Guide

Published October 5, 2021
Laravel Eloquent relationships for beginners – Full 2021 Guide

Laravel Eloquent is one of the flagship features of the Laravel framework. In part that is also thanks to its awesome support for defining, creating and managing relationships between different tables of data. In this tutorial I’ll show you how to create and use Eloquent relationships, so that you can get up and running without any previous knowledge of relationships.

What are database relationships?

First, let’s start with the absolute basics. What is a relationship exactly?

How to manage DateTime with Carbon in Laravel & PHP

Published September 10, 2021; last updated on October 1, 2021
How to manage DateTime with Carbon in Laravel & PHP

At some point, almost every Laravel application needs to work with dates and times. But managing dates and times is sometimes ridiculously complex, because of timezones. In which timezone do you store dates and times? How do you calculate differences between times?

Luckily, there’s Carbon: a simple PHP API extension for DateTime. That might sound very complex, but it really isn’t. Laravel uses Carbon by default, but the documentation barely talks about it.

Laravel Eloquent for Beginners | Full guide (2021)

Published September 3, 2021; last updated on September 10, 2021
Laravel Eloquent for Beginners | Full guide (2021)

Laravel Eloquent is one of Laravel’s flagship features and one of the most notable things that distinguishes Laravel from other PHP frameworks. The Laravel Eloquent ORM is a way to interact with your database. In this tutorial I’ll show you the basics of using Laravel Eloquent, so that you can start using Eloquent quickly.

So, what is Eloquent exactly? Or what is an Eloquent model? It effectively comes down to the following: for each table you have in your database,

Laravel Databases & Migrations for Beginners (2021)

Published August 20, 2021; last updated on September 10, 2021
Laravel Databases & Migrations for Beginners (2021)

Laravel provides a whole bunch of tools to interact with your application’s database. The most important one is Eloquent, which is one of Laravel’s most popular and influential features. In a world of powerful, but complex tools, Eloquent stands out for its simplicity. But before we dive into Eloquent, it’s a good idea to first get everything set up and understanding the basics of Laravel’s database functionality: connections & migrations.

In this tutorial,

How to solve Composer PHP memory exhausted issue in 30 seconds (2021)

Published August 6, 2021
How to solve Composer PHP memory exhausted issue in 30 seconds (2021)

Nothing is more irritating than software that should just work, whilst it doesn’t. One of those highly irritating things are problems with composer. One of those problems is the error message ‘Allowed memory size of {indecipherable number} bytes exhausted’. To fix this, you need to go and edit your PHP’s configuration. But luckily, there’s a way that’s even faster and simpler.

The problem here is that Composer doesn’t have enough memory.

How to use Browsersync with Laravel Valet (2021)

Published August 3, 2021; last updated on September 10, 2021
How to use Browsersync with Laravel Valet (2021)

If you’re a developer in the PHP world, it’s likely that you’ve come across Laravel Valet. Laravel Valet is a very easy way to spin up multiple local development environments, by linking a folder name to a {folderName}.test domain.

Browsersync is a tool to make developing easier. It offers handy tools, of which the most important is automatic browser reloading on file change. Unfortunately Browsersync doesn’t work out-of-the-box with Laravel Valet, but luckily it requires only a little configuration.

How to validate Laravel user input for beginners (2021)

Published July 23, 2021; last updated on September 10, 2021
How to validate Laravel user input for beginners (2021)

Laravel is by far the most popular PHP framework, due to its enormous flexibility, awesome community and shallow learning curve. Handling and validating user input is perhaps one of the most important things in Laravel. In this article I’ll show you the three methods for validating user input.

For this article I’ll assume you already have a form and something similar to the following two routes:

use App\Http\Controllers\PostController;

Route::get(‘/post/create’, [PostController::class, ‘create’]);
Route::post(‘/post’,

How to use Tailwind CSS v2.1 JIT compiler with WordPress theme (2021)

Published July 13, 2021; last updated on September 10, 2021
How to use Tailwind CSS v2.1 JIT compiler with WordPress theme (2021)

Tailwind CSS is an awesome way of writing CSS – it completely transformed the way I write CSS. In this article I’ll show you how to use Tailwind CSS in a WordPress theme, and how to set it up with npm.

First, we’ll create the initial scaffold for our WordPress theme. Then, we’ll install npm in our project. Finally, we’ll install Tailwind and watch the magic happen. 🚀

  1. Creating a WordPress theme from scratch
  2. Installing npm in our project
  3. Installing Tailwind in our project

Prerequisites
To install Tailwind CSS,

How to apply .gitignore to an existing Git repository

Published June 29, 2021; last updated on July 5, 2021
How to apply .gitignore to an existing Git repository

Git is an awesome tool to track the version history of your files and to collaborate on software development. Almost every project you create has a .gitignore file, to specify which files in the directory should not be tracked by Git. But sometimes you want to change or update your .gitignore in order to remove a file from your repo. Unfortunately, those changes are not reflected immediately by Git: you have to apply the .gitignore file again.

How to rollback the latest Laravel database migration(s)

Published June 29, 2021; last updated on July 5, 2021
How to rollback the latest Laravel database migration(s)

Building Laravel database migrations that are good right away is hard – especially for beginners. That’s why you’d often want to make a change to your migration, only to discover that you’ve already migrated your database. Luckily, it’s very easy in Laravel to correctly rollback only your last database migration(s).

First, let’s just check which database migrations we’ve already run. To do so, run the command php artisan migration:status on the command line (make sure to navigate to the directory with your application files first).

How to uninstall Homebrew on macOS – Full Guide (2021)

Published June 18, 2021
How to uninstall Homebrew on macOS – Full Guide (2021)

Homebrew is a great tool to manage packages on macOS. However, there might come a moment that you want to fully uninstall it. Perhaps you need to do a clean install again or there is an other reason. Anyway, uninstalling Homebrew is not difficult. In this tutorial, I’ll show you how to uninstall Homebrew.

Uninstalling Homebrew is very similar to the way it is installed. Open up your terminal and paste the following command:

/bin/bash -c “$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/uninstall.sh)”

This script will show you what it will delete and ask you if you want to continue uninstalling Homebrew.

How to install Homebrew on macOS – Full guide (2021)

Published June 15, 2021; last updated on September 10, 2021
How to install Homebrew on macOS – Full guide (2021)

Homebrew is a great way to manage packages on macOS. Arguably it is one of the best package managers out there, because it’s simple to use and offers thousands – if not more – packages with just a few simple commands. In this guide I’ll show you how to install Homebrew on macOS, so that you can get up and running immediately.

Homebrew is an app that works via the terminal. That means that there isn’t a native ‘regular’

How to switch between Node.js versions with Homebrew (2021)

Published May 4, 2021; last updated on September 10, 2021
How to switch between Node.js versions with Homebrew (2021)

Homebrew is an awesome tool for installing and managing packages installed on macOS. It is also the best way to install Node.js and, with that, npm. But sometimes you’ll need a different version of Node.js than the latest. In this tutorial I’ll show you how to switch between multiple versions of Node.js on macOS with Homebrew.

First we need to make sure that your environment is ready. If you’ve not already done so,

How to download your deployed Netlify builds

Published April 27, 2021; last updated on September 10, 2021
How to download your deployed Netlify builds

I’m just beginning to discover Netlify, but I really enjoy the platform. Did you know that Netlify allows you to download the source files for each deploy? That effectively means that you can use Netlify as a build-tool and host the static files somewhere else! Exciting, isn’t it?

Recently I’ve been playing around a bit with Ghost and I was looking for a way to download all the images and uploaded content. That turned out to be more difficult than expected,

How to use GitHub Actions with webhooks & API endpoints

Published April 23, 2021; last updated on September 10, 2021
How to use GitHub Actions with webhooks & API endpoints

GitHub Actions is a great tool for every developer. It can be easily incorporated in your development workflow. Sometimes you’d need to visit a certain endpoint, for example in a REST API. Luckily, this is very easy with GitHub Actions. In this tutorial I’ll show you how to use curl to visit API endpoints.

First, what is curl? Curl (or cURL) is a tool for getting data from a URL and transferring data to it.

How to check your Laravel database connection

Published April 16, 2021; last updated on September 10, 2021
How to check your Laravel database connection

Laravel is a great framework for rapid application building. It allows you to easily connect to a database. If you’re developing locally, chances are that you need to confirm that the application is connected to a database, for example when you’re debugging something.

In this tutorial I’ll show you how to check which database your Laravel app is connected to.

There is a simple code snippet to check the name of the current database connection,

How to use Tailwind CSS v2.1 JIT compiler with Laravel Mix

Published April 12, 2021; last updated on November 30, 2021
How to use Tailwind CSS v2.1 JIT compiler with Laravel Mix

Last week Tailwind CSS released version 2.1.0. One of the best features of the release is the fact that the new Just-In-Time (JIT) compiler is now included in the official build. In this tutorial I’ll show you how to use the Tailwind CSS JIT compiler with Laravel Mix. Best of all is that it takes less than two minutes🚀

The compiler is a huge step forward in the development of Tailwind CSS. There are several important advantages,

How to use DBngin & TablePlus for local development

Published April 6, 2021; last updated on September 10, 2021
How to use DBngin & TablePlus for local development

DBngin is very handy and lightweight application to get MySQL, PostgreSQL and Redis databases on your local machine. It features a simple way to spin up one or more databases. The combination with TablePlus – its ‘sister’-software – makes it very easy to view, manage and edit your databases. In this tutorial I’ll show you how to get your first DBngin database up and running and which credentials you need to use to connect to it.

How to allow only positive integers in HTML number input elements

Published March 30, 2021; last updated on April 6, 2021
How to allow only positive integers in HTML number input elements

I recently found myself in the situation where I was using an HTML number input element, but where I wanted to only accept positive numbers. That might seem like an easy task, but it turned out that it was quite complicated and that you needed to sprinkle in a little bit of JavaScript. In this article, I’ll show you how to only allow positive number input.

Let’s start with a simple HTML input element.

How to combine structured data into one script tag

Published March 16, 2021; last updated on September 10, 2021
How to combine structured data into one script tag

Adding structured data to pages on this blog has really helped improve my rankings. But sometimes you want to combine two or more ‘blocks’ of schema markup in the same <script> tag. On this page, I’ll show you how to combine multiple structured data elements into one declaration.

What is the ‘classic’ way to add structured data to a page? A single declaration is added in a <script> tag with a type of ld+json.

Install Tailwind CSS & SASS with Laravel Mix (2021)

Published March 12, 2021; last updated on September 10, 2021
Install Tailwind CSS & SASS with Laravel Mix (2021)

Laravel Mix is a great tool for defining Webpack build steps for several common CSS and JavaScript pre-processors. Personally I’m a huge fan of TailwindCSS and I use it in a lot of projects. For writing plain CSS I prefer to use SASS (SCSS). Here I’ll show you how to set up your Laravel application with SASS and Tailwind CSS.

For this tutorial I already have a local Laravel application installed with Laravel Valet.

How to bulk move multiple files with GitHub Desktop

Published March 9, 2021; last updated on September 10, 2021
How to bulk move multiple files with GitHub Desktop

Moving multiple files at once in the online GitHub environment is not really handy. You’d have to change the name for each individual item and you can’t just drag-and-drop items. One of the easiest ways to bulk move files is by using the GitHub Desktop app. I’ll show you how to do it.

What is GitHub Desktop?

The first step is to install the GitHub Desktop app. The Desktop app is a simple client to work locally with your GitHub repositories.

How to fix Laravel command not found on macOS for bash/zsh

Published March 2, 2021
How to fix Laravel command not found on macOS for bash/zsh

If you’re developing Laravel applications, you’re very likely to use a local development installation. Installing Laravel is not very simple, especially if you’re not familiar with composer or with the command line. In this tutorial, I’ll show you a simple way that will most likely fix the problem.

For this tutorial, I’ll assume that you’ve already got Composer installed (globally).

Before starting, you should determine whether you’re using bash or zsh as a command line shell.

How to define the $query parameter for Elementor

Published February 23, 2021; last updated on September 10, 2021
How to define the $query parameter for Elementor

The Elementor page builder is a great page builder for building WordPress websites. It offers a plethora of extra functions to be used by developers. Often, you’ll come across the $query parameter. This parameter is intended to define media queries and can be helpful with functions like add_rules. In this post, I’m going to show you how it works and how you can use it.

This article is a sequel to my earlier article about using the Elementor add_rules function.

Automatic WordPress update mechanism with GitHub Updater

Published February 19, 2021; last updated on September 10, 2021
Automatic WordPress update mechanism with GitHub Updater

Adding a custom update mechanism to your WordPress themes and plugins is very handy. Unfortunately it’s currently quite difficult to do with core WordPress functions. I’ll show you how to use GitHub to add your own custom WordPress theme and plugin update mechanism.

So, how will we do this? First, we create a GitHub repository for our theme or plugin files. Then, we’ll see how to use this and I’ll show you how to version your files.

How to check whether the Elementor editor is active

Published February 12, 2021
How to check whether the Elementor editor is active

Elementor is a great page builder, but integrating it in your theme can sometimes come with a few hurdles. One of those is checking whether the editor is active – or if the page is being edited. Depending on that, you might want to load or not load certain stylesheets or scripts. Or perhaps you’ve an other use case. Anyway, checking this is really easy.

To check this, Elementor has a handy function built in,

How to use the Kirki typography control: custom fonts & Google

Published February 9, 2021; last updated on September 10, 2021
How to use the Kirki typography control: custom fonts & Google

Have you ever wanted to give your theme users an easy option to control the typography of certain elements? Adding this sort of functionality is not available by default in the WordPress Customizer API, so you’d end up having to write some sort of custom control. Luckily, the Kirki Customizer Framework has a very handy typography control built into it. Learn how to use the Kirki typography control.

To start with Kirki, you need to have Kirki installed on a WordPress installation.

Site performance: the first two months in Google

Published February 6, 2021; last updated on September 10, 2021
Site performance: the first two months in Google

I started this website in the first half of December, 2020, so now it’s up and running for about two months. As I’m myself always interested in the performance and the ‘dashboard’ info of others, I thought it would be a fair to every now and then share a sort of ‘performance report’ here. I’ve compiled some numbers and some screenshots of Google Search Console here, so have fun✌️

I primarily use Google Search Console to get an indication of how my website is doing now.

How to unfork a GitHub repository (2021 official method)

Published February 2, 2021; last updated on September 10, 2021
How to unfork a GitHub repository (2021 official method)

Who doesn’t love GitHub? And who hasn’t their GitHub account cluttered with forked repositories of projects you’ve long stopped contributing too? Do you want to clean up your account and unfork outdated repositories? Learn how to unfork a GitHub repo the correct way.

How to unfork a repository

Unfortunately, GitHub doesn’t offer an Unfork repository button. Unforking is a manual process which needs to be done by a GitHub employee. But because of the large demand for unforking or detaching repositories,

Check whether a Gravatar exists for a specific e-mail

Published January 29, 2021; last updated on September 10, 2021
Check whether a Gravatar exists for a specific e-mail

Gravatar is a great tool for getting avatars and profile images associated with a specific e-mailaddress. By default, if somebody has specified an image for their e-mail, that image can easily be retrieved. If the user doesn’t have an e-mail, Gravatar will return a standard image.

But what if you don’t want that default image? Gravatar has no easy option to check whether an image exists. WordPress has a function for this, called has_avatar(),

Automatically add anchor links to Gutenberg headings

Published January 26, 2021; last updated on September 10, 2021
Automatically add anchor links to Gutenberg headings

When you have a blog, you sometimes just want to link to the start of a specific paragraph. Especially with longer articles, I like to break it up in larger chunks. Unfortunately, the Gutenberg editor doesn’t automatically add an id to every heading it generates. You’d have to do this manually. As this is a very laborious task, especially when you publish regularly, I’m happy that there is an automated way of adding this.

Below a small table of contents for this article,

Create a custom cursor with CSS effects in iPadOS style

Published January 15, 2021; last updated on September 10, 2021
Create a custom cursor with CSS effects in iPadOS style

Custom cursors and hover effects have been advancing steadily on the web for the last two years. It makes a website more sophisticated and gives a certain elegance to it. I’ve been playing with custom animated cursors and hover effects and it turns out that it’s really easy to create a custom animated cursor – without much impact on page load and without huge JS libraries.

In this tutorial, I’ll show you how to create a custom animated cursor and implement that on your website.

Create a category dropdown in WordPress customizer

Published January 8, 2021; last updated on September 10, 2021
Create a category dropdown in WordPress customizer

Whether you’re building a WordPress theme or a WordPress plugin, chances are that you need your users to select a certain category or multiple categories. For example, to apply some functionality or use different styling. You could do this via the WordPress customizer or, for example, in your own admin panel.

In this tutorial I’ll show you how to get a list of all the categories and how to rewrite that list to the format you need.

How to output custom HTML for WordPress comments

Published January 4, 2021; last updated on September 10, 2021
How to output custom HTML for WordPress comments

When you’re developing a WordPress theme, chances are that you want to or need to implement comments. WordPress makes this really easy with the wp_list_comments() function. How do we output the comments in a custom HTML format?

The wp_list_comments() function can take over fourteen arguments, so you would think: choices enough! But unfortunately, there is no parameter with which you can modify the HTML output. You can of course apply CSS, but sometimes you do need a different HTML output to accomplish a certain design.

How to exclude subdomains from WordPress Multisite

Published December 29, 2020; last updated on January 4, 2021
How to exclude subdomains from WordPress Multisite

I love WordPress Multisite. It allows you to get a new WordPress site up and running within minutes. Especially if you’re a developer and want to test a new theme (version) on a plain installation, this is really handy. Or if you are a company and you need a new site, e.g. for a project.

WordPress Multisite works with both subfolders and subdomains. Subfolders are sites created at domain.com/newsiteslug and subdomains are subdomain.domain.com.

How to use the Elementor Stylesheet::add_rules

Published December 22, 2020; last updated on September 10, 2021
How to use the Elementor Stylesheet::add_rules

When developing WordPress themes that use the Elementor page builder, you’ll sometimes want to add additional CSS to the stylesheet of a page. Elementor provides an extremely large amount of functions and hooks, but examples are scarce. In this article, I’ll give an example of adding CSS to an Elementor stylesheet.

How do CSS stylesheets work in Elementor

For this tutorial, I created a very simple page in Elementor. This page only contains a title.

Overview of the_content: Gutenberg & Elementor

Published December 18, 2020; last updated on December 19, 2020
Overview of the_content: Gutenberg & Elementor

For beginning WordPress developers, it can be difficult to grasp the concept of the WordPress the_content() function. In this post, I aim to explain the_content() in relation to WordPress single.php and page.php template. I’ll also explain how it is used by Gutenberg, Elementor and other page builders.

What is the_content() exactly?

First things first, what is exactly the the_content() function? The the_content() displays the content of a certain page or post. You know that pages and posts are of course editable by users.

How to add icons to customizer panels and sections

Published December 15, 2020; last updated on September 10, 2021
How to add icons to customizer panels and sections

The WordPress customizer is a great way to add theme options to a WordPress theme. The controls in the customizer are added in sections or panels. This allows you to structure your theme options. But when you have several extra panels or sections registered, things can start to become a bit unclear. In this tutorial you’ll learn how to easily add icons to panels in the WordPress customizer, which greatly improves the look and feel of the customizer.

How to clean up WP head-tag and improve pagespeed

Published December 11, 2020; last updated on December 18, 2020
How to clean up WP head-tag and improve pagespeed

The <head> tag WordPress generates is not tailored for performance, but only to suit the biggest audience possible. This means that on every optimised page, there are at least several tags and scripts redundant. Luckily, there’s an easy way to clean up the WordPress header tag and increase performance on your WordPress site.

  1. Remove the generated by WordPress tag
  2. Remove the RSD link
  3. Remove the WordPress REST API link
  4. Remove the WLW Manifest link
  5. Remove shortlink

1.

Conditionally output CSS from the customizer

Published December 8, 2020; last updated on September 10, 2021
Conditionally output CSS from the customizer

Enhancing your WordPress theme with customizer options means a great increase in user experience. In a lot of cases you would want to conditionally output CSS. In this tutorial I’ll show you the best way to conditionally output CSS from the WordPress customizer.

To accomplish this, I’ll be using the Kirki customizer framework. I highly recommend this framework to every WordPress theme developer, because it saves you tonnes of time configuring the customizer.

Beginners guide for the Kirki customizer framework

Published December 4, 2020; last updated on September 10, 2021
Beginners guide for the Kirki customizer framework

The WordPress customizer is a great tool to add options to your WordPress theme so users can customize it. There are many frameworks that allow theme developers to add options to their theme, usually in a specific admin panel. Kirki is a framework that allows you to add controls to the customizer, in a simple, fast and easily maintainable way.

In this guide, I’m going to introduce you to Kirki and explain how it works.

How to use TGM Plugin Activation – Full beginner’s guide (2021)

Published November 20, 2020; last updated on September 10, 2021
How to use TGM Plugin Activation – Full beginner’s guide (2021)

When building a WordPress theme, it’s likely that your theme depends on one or more plugins. This can be plugins like page builders or a custom theme plugin. Some plugins are required for the theme to function properly and some plugins you’ll only want to recommend.

One of the more popular ways to let people know that certain plugins are required/recommended is by using the TGM Plugin Activation library. This is a simple library that takes care of displaying a pop-up,

8 reasons to use Kirki as theme developer

Published November 12, 2020; last updated on September 10, 2021
8 reasons to use Kirki as theme developer

If you are a WordPress theme developer, you’re likely to spend hours making your theme customisable via the WordPress customizer. Adding settings, connecting them to controls, trying not to lose the overview. Kirki is a simple and free framework, that allows you to quickly add more than 30 advanced controls with a simple syntax. All the controls are beautifully designed and specifically optimised for the WordPress customizer.

There are several very good reasons to consider Kirki as your go-to framework for quickly building and adding customizer settings.

How to integrate Elementor in a WordPress theme

Published October 12, 2020; last updated on September 10, 2021
How to integrate Elementor in a WordPress theme

The Elementor page builder is the world’s best WordPress page builder and is used by millions of people. Integrating Elementor in your WordPress theme is easy and free, and doing so brings your theme millions of potential customers.

This tutorials explains how to integrate Elementor with your WordPress theme in a few simple steps. I’m going to go over some basic concepts and techniques that are important when using Elementor in your theme.

Close
Stay up to date with all things Laravel, Tailwind, WordPress & PHP

Subscribe now to my e-mail newsletter and get my latest articles and project updates delivered directly to your inbox. Never miss an update.