Sitemap

Sitemap

This is a sitemap of most of the content on my site. Some static pages (like the about me page, etc) might not be linked to from here.

Main pages

Blog posts

The Repository Pattern in PHP (and Laravel)

Laravel Naming Conventions

Vimattack: How to get someone's database credentials while they are editing config files on a live server

Should you disable Vim's swap files (.swp) being created?

Strategy Design Pattern in PHP - Explained!

How to sort lines of text from within vim (super easy!)

Why You Should Use SPL Exceptions in PHP, for Better Exception Handling

Exporting data with mysqldump

Linux Command Cheatsheet: Disk usage and filesize cheatsheet

Bash Parameter Expansions (!$, etc)

PHP Observer Design Pattern Explained (Easy to understand)

Best Chrome Extensions for Web Developers

Essential keyboard shortcuts you NEED to know when using PHP Storm

Beginners Guide to Tabs in Vim

PHP Template Method Pattern Explained (its easy!)

Super Easy Introduction Guide to Using Vim To Edit Your Files

Welcome to WebDevEtc

The Front Controller Design Pattern (explained using PHP)

How to use clip-path in CSS (with examples)

The Service Locator Design Pattern in PHP

The Decorator Design Pattern in PHP (with easy to follow example)

How to add a gradient overlay to a background image using just CSS and HTML

Everything you need to know about SQL injection with PHP and MySQL

The Adapter Design Pattern, Explained With PHP

Laravel + SQLite - works in php artisan tinker, but gives "unable to open db file" - FIXED

The Chain-of-responsibility programming design pattern (explained using PHP)

Why You Should Never Host Your Own Videos, And What 3rd Party Video Hosting Services Are The Best To Use

Vim tip: The best line number config (current + relative line numbers)

The Composite Design Pattern Explained (with PHP)

Array Destructuring: The Useful PHP 7 Feature You (maybe) Aren't Using

Specification Design Pattern in PHP - Explained!

How to create a new MySQL (MariaDB) Database, user, and grant it privileges

Programming Tricks

PHP Tricks and Tips

PHP - Arrays Tips

What are generators in PHP, and how do they compare to arrays? What are generators in PHP, and how do they c...

How to pick what array_intersect function to use in PHP? How to pick what array_intersect function to...

An overview of every main PHP array function An overview of every main PHP array function...

How to Extract Query String (from a URL) Into an Associative Array in PHP How to Extract Query String (from a URL) Into...

How to convert a string to an array of it's characters in PHP? How to convert a string to an array of it's c...

How to find the 2nd most common item in an array? How to find the 2nd most common item in an ar...

How to sort an array of dates and times? How to sort an array of dates and times? (SOL...

How to find the intersection (same values) from two arrays? How to find the intersection (same values) fr...

PHP - General Tips

How to manually write your own pagination in PHP How to manually write your own pagination in...

What are the SPL data structures What are the SPL data structures (SOLVED): Th...

What are the SPL Iterators in PHP? What are the SPL Iterators in PHP? (SOLVED):...

How do you access the php://input stream? How do you access the php://input stream? (SO...

What are PHP's PSRs? What are PHP's PSRs? (SOLVED): PSRs are PHP S...

What is the max size, by default, of GET variables? What is the max size, by default, of GET vari...

When is __destruct called in PHP? When is __destruct called in PHP? (SOLVED): T...

What are the main error types in PHP What are the main error types in PHP (SOLVED)...

What does PEAR stand for? What does PEAR stand for? (SOLVED): PEAR stan...

How to check if a object has a static variable defined? How to check if a object has a static variabl...

How can you check if a variable is alphanum (alphanumeric, letters and numbers only) in PHP? How can you check if a variable is alphanum (...

What is snake case? What is snake case? (SOLVED): Snake case is t...

What is camel case? What is camel case? (SOLVED): Camel case is w...

How to set infinite execution time in a PHP script How to set infinite execution time in a PHP s...

What is the spaceship operator (<=>) in PHP? What is the spaceship operator (<=>) in PHP?...

How to use Anonymous classes in PHP 7? How to use Anonymous classes in PHP 7? (SOLVE...

How to destroy or remove a cookie in PHP How to destroy or remove a cookie in PHP (SOL...

How does PHP compare objects? How does PHP compare objects? (SOLVED): If tw...

Is multiple inheritance supported in PHP? Is multiple inheritance supported in PHP? (SO...

How to replace whitespace with a single space How to replace whitespace with a single space...

What is the null coalescing operator in PHP7? What is the null coalescing operator in PHP7?...

How to reverse htmlentities() / What is the opposite of htmlentities()? How to reverse htmlentities() / What is the o...

What does 'final class' and 'final function' (final method) mean in PHP? What does 'final class' and 'final function'...

How do you launch the PHP interactive shell? How do you launch the PHP interactive shell?...

How to view all installed PHP modules? How to view all installed PHP modules? (SOLVE...

How to find out which php.ini file PHP is using? How to find out which php.ini file PHP is usi...

How do you run a PHP script from the command line? How do you run a PHP script from the command...

How to query mysql using PDO in PHP? How to query mysql using PDO in PHP? (SOLVED)...

How could you include a custom function for every single time PHP runs? How could you include a custom function for e...

How to check if two strings are anagrams in PHP? How to check if two strings are anagrams in P...

PHP - PHP Basics Tips

How to add comments in PHP How to add comments in PHP (SOLVED): Comments...

How to output (echo/print) content in PHP How to output (echo/print) content in PHP (SO...

What are the predefined variables in PHP? What are the predefined variables in PHP? (SO...

PHP Date commonly used formats PHP Date commonly used formats (SOLVED): The...

What is the difference between empty(), isset(), != null, is_null() in PHP What is the difference between empty(), isset...

Laravel Tricks and Tips

Laravel - Blade Templating System Tips

How to check if a user is logged in, inside a blade file? How to check if a user is logged in, inside a...

What is the loop variable in a @foreach loop in Blade? What is the loop variable in a @foreach loop...

How to get a route to directly show a view? How to get a route to directly show a view? (...

How to check if a (blade) view file exists How to check if a (blade) view file exists (S...

How to do comments in Blade files? How to do comments in Blade files? (SOLVED):

Laravel - Controllers Tips

How do Invokable Controllers work in Laravel? How do Invokable Controllers work in Laravel?...

Laravel - Laravel Database Stuff Tips

How to increment a value in the database How to increment a value in the database (SOL...

How to change the order that migrations happen? How to change the order that migrations happe...

How to fix the MySQL related "Specified key was too long error" error in Laravel How to fix the MySQL related "Specified key w...

How to select what columns to return when calling ::all() How to select what columns to return when cal...

What kind of database field type should you (normally) use for foreign keys? What kind of database field type should you (...

How to show (or log) all SQL queries executed by Laravel How to show (or log) all SQL queries executed...

How to group a SQL statement in brackets/parenthesis How to group a SQL statement in brackets/pare...

Laravel - Eloquent Tips

How to order a Laravel hasMany relationship? How to order a Laravel hasMany relationship?...

A list of operators on Eloquent's where() method A list of operators on Eloquent's where() met...

How to provide a default model object for relationships? How to provide a default model object for rel...

How to prevent Eloquent from adding created_at or updated_at timestamps? How to prevent Eloquent from adding created_a...

How to undelete a soft deleted Eloquent row? How to undelete a soft deleted Eloquent row?...

How to eager load multiple levels of relationships in Eloquent? How to eager load multiple levels of relation...

How to generate an array for a dropdown (with ['key' => 'value']) suitable for a dropdown, from a Laravel collection of Eloquent objects? How to generate an array for a dropdown (with...

How to get table column names from a database table in Eloquent? How to get table column names from a database...

How to check if a relation was loaded on an Eloquent model already? How to check if a relation was loaded on an E...

How to get the first row that matches some where queries, or create it if it doesn't exist (in Laravel's Eloquent)? How to get the first row that matches some wh...

How to find an item by Primary Key in Eloquent, or throw a ModelNotFoundException exception if it isn't found? How to find an item by Primary Key in Eloquen...

How to return an item in Eloquent, or throw a ModelNotFoundException exception if it isn't found? How to return an item in Eloquent, or throw a...

How to select all rows for a certain month (or day, year or time), using Eloquent How to select all rows for a certain month (o...

Laravel - Routes and Routing Tips

What are route patterns in Laravel? What are route patterns in Laravel? (SOLVED):...

How to namespace a Laravel route group? How to namespace a Laravel route group? (SOLV...

How to use subdomains as parameters in your routes (or in your web.php file) How to use subdomains as parameters in your r...

How to add a name prefix to all routes in a group? How to add a name prefix to all routes in a g...

How to access the Laravel's route parameters outside of the controller? How to access the Laravel's route parameters...

How to make multiple routes share the same URL structure or URL parameters How to make multiple routes share the same UR...

Laravel - General Laravel Stuff Tips

Why should you update APP_URL from from http://localhost? Why should you update APP_URL from from http:...

How to show a specific view file for certain error codes? How to show a specific view file for certain...

What are macros in Laravel? What are macros in Laravel? (SOLVED): Macros...

How to find out what version of Laravel you are using? How to find out what version of Laravel you a...

How to see all of the options for an artisan command? How to see all of the options for an artisan...

How to add the CSRF (Cross-site request forgery) token in Laravel? How to add the CSRF (Cross-site request forge...

How to exclude URLs from the Laravel CSRF protection? How to exclude URLs from the Laravel CSRF pro...

How to return JSON data to the user in Laravel? How to return JSON data to the user in Larave...

How to run an artisan command from a controller How to run an artisan command from a controll...

Laravel - Laravel Collections Tips

How to find the average value of items in a Laravel Collection? How to find the average value of items in a L...

Composer Tricks and Tips

Apache Tricks and Tips

Apache - Rewrite and Redirection .htaccess Rules Tips

How to enable the rewrite engine in .htaccess? How to enable the rewrite engine in .htaccess...

How to set environmental variables in your .htaccess file How to set environmental variables in your .h...

How to Force www or non-www in htaccess How to Force www or non-www in htaccess (SOLV...

How to redirect your website to a new domain/location in .htaccess How to redirect your website to a new domain/...

How to remove .php from the end of URLs with .htaccess How to remove .php from the end of URLs with...

How to force non www in htaccess How to force non www in htaccess (SOLVED): If...

How to force SSL in Apache's .htaccess? How to force SSL in Apache's .htaccess? (SOLV...

Point all requests to one PHP file Point all requests to one PHP file (SOLVED):...

How to set up an alias to map one directory to another destination How to set up an alias to map one directory t...

301 Redirect a single URL in .htaccess to a new location 301 Redirect a single URL in .htaccess to a n...

Remove trailing slash (redirect to remove trailing slash) in .htaccess Remove trailing slash (redirect to remove tra...

Force trailing slash (redirect if no trailing slash exists) in .htaccess Force trailing slash (redirect if no trailing...

What is WordPress default Apache .htaccess rules? What is WordPress default Apache .htaccess ru...

Apache - .htaccess Security Tips

How to block an IP address in .htaccess How to block an IP address in .htaccess (SOLV...

How to block multiple IP addresses in .htaccess How to block multiple IP addresses in .htacce...

How to block IP addresses in Apache by using regular expressions (regex) in .htaccess How to block IP addresses in Apache by using...

How to block an IP range based on CIDR in Apache with .htaccess How to block an IP range based on CIDR in Apa...

How to block IPv6 IP addresses in .htaccess How to block IPv6 IP addresses in .htaccess (...

Apache - General .htaccess Tricks Tips

How to hide directory listing in .htaccess? How to hide directory listing in .htaccess? (...

How to Enable Directory Listings in Apache with .htaccess How to Enable Directory Listings in Apache wi...

How to hide certain file types from directory listings How to hide certain file types from directory...

How to set the timezone to UTC in .htaccess How to set the timezone to UTC in .htaccess (...

How to make Apache force download of files (in .htaccess) How to make Apache force download of files (i...

How to hide the server signature (hide Apache info) from HTTP headers with .htaccess How to hide the server signature (hide Apache...

How to have a whitelist of IP addresses that can access files in .htaccess How to have a whitelist of IP addresses that...

How to set custom HTTP headers in Apache (by editing .htaccess) How to set custom HTTP headers in Apache (by...

How to set up custom error pages in .htaccess for your Apache server (ErrorDocument) How to set up custom error pages in .htaccess...

How to force gzip compression in Apache with .htaccess How to force gzip compression in Apache with...

Set PHP config Variables (like ini_set) with .htaccess Set PHP config Variables (like ini_set) with...

How to add the default charset to UTF-8 in .htaccess How to add the default charset to UTF-8 in .h...

How to disable file hotlinking in Apache with .htaccess How to disable file hotlinking in Apache with...

How to set the Expires header in .htaccess How to set the Expires header in .htaccess (S...

How to block access to certain referrers in Apache using .htaccess How to block access to certain referrers in A...

How to set up an alias to map one directory to another destination How to set up an alias to map one directory t...

Apache - General Apache Tips Tips

What are Apache MPMs? What are Apache MPMs? (SOLVED): Since Apache...

CentOS and Linux Stuff Tricks and Tips

CentOS and Linux Stuff - Installing Programs in CentOS Tips

How to install jpegtran for Linux CentOS How to install jpegtran for Linux CentOS (SOL...

How to install and use jpegoptim on Linux CentOS How to install and use jpegoptim on Linux Cen...

How to install and use optipng on Linux CentOS How to install and use optipng on Linux CentO...

WordPress Tricks and Tips

General Webdev and Programming Stuff Tricks and Tips

JavaScript Tricks and Tips

JavaScript - General JavaScript Tips

What is the difference between ( for ... in ) and ( for ... of ) in javascript? What is the difference between ( for ... in )...

How to check if a string contains a certain substring? How to check if a string contains a certain s...

How to replace values in a string, in JS How to replace values in a string, in JS (SOL...

What are Template literals (Template strings) in JS? What are Template literals (Template strings)...

How to split a string into an array, in JS How to split a string into an array, in JS (S...

How to get the last character of a string in JS? How to get the last character of a string in...

How to round a number in JS? How to round a number in JS? (SOLVED): Use th...

How to create random numbers in JS? How to create random numbers in JS? (SOLVED):...

How to sort an array in javascript? How to sort an array in javascript? (SOLVED):...

How to convert between types in JS? How to convert between types in JS? (SOLVED):...

How to merge/concat two arrays together in JS? How to merge/concat two arrays together in JS...

What is an example of an object literal? What is an example of an object literal? (SOL...

How to add and remove items to an array in JS? How to add and remove items to an array in JS...

How to find the index of a value in an array in JS? How to find the index of a value in an array...

How to get the type of a variable in JS? How to get the type of a variable in JS? (SOL...

What is the difference between reference and primitive data types types in Javascript? What is the difference between reference and...

How to check if an object or variable is an array, in JS? How to check if an object or variable is an a...

What is the difference between var, let and const in Javascript? What is the difference between var, let and c...

What are some ways you can log debug messages and data in JS? What are some ways you can log debug messages...

Search site

About

Welcome to my site about web dev! You can find articles and tricks related to webdev - but focusing on PHP and Laravel.

All posts/pages are hand written by me. If you spot an error please get in touch :)

If you are looking to hire someone (for a big project, work, or to fix a small problem) get in touch :). I'm based in Europe, but from London originally. Contact