Johnathan Smith

Full Stack Laravel Developer + Consultant

Johnathan Smith
I'm a web developer that specializes in Laravel, PHP, Vue, Javascript and more. I work 100% remotely from my home office near Raleigh, NC. Come get to know me better!



Use Interfaces - Stop Extending Classes

Use Interfaces - Stop Extending Classes

We need to rely on methods and drop using state.

Using interfaces is easy and keeps your code clean. This will keep your code clean and extendable.

Alternative to Named Params With Config Classes for PHP

Alternative to Named Params With Config Classes for PHP

Taking a lesson from Go

We can use some object oriented techniques to set configurations rather than arrays or endless constructor types.

Blazing Fast polymorphic relationship database queries in Laravel

Blazing Fast polymorphic relationship database queries in Laravel

For mysql, postgres, sqlite, and other relational databases

Eloquent Trick to get amazing speeds with polymorphic relationship queries using compound indices.

PHP Array Destructuring - And its Cool Hidden Feature

PHP Array Destructuring - And its Cool Hidden Feature

Assign returned variables and skip them too!

Did you know that you can destructure arrays, just like you can in es6 JavaScript?

Introducing xttp: A fluent wrapper for Guzzle

Introducing xttp: A fluent wrapper for Guzzle

With typehints, return types, and oozing with syntactic sugar

An incredibly useful PHP package that makes working with Guzzle so simple. There's also a Laravel package too!

Resist The Shiny: Stop Worrying about the Latest Trend

Resist The Shiny: Stop Worrying about the Latest Trend

Forget FOMO with web development

You really need to forget the latest and greatest. Use the best and the popular. Stay informed, but don't let it conform you.

MySQL Common Table Expressions with Eloquent and Laravel

MySQL Common Table Expressions with Eloquent and Laravel

Using CTE in your Project

Common Table Expressions are incredibly useful in MySQL 8. However, Laravel does not support it out of the box. Let's see how we can use a package to support this.

Laravel: Creating Many to Many Relationships - The Definitive Guide

Laravel: Creating Many to Many Relationships - The Definitive Guide

Taking full advantage of all the built-in functionality

The article includes the best way to understand a many to many relationship and write a migration.

PHPUnit and Testing Specific Folders

PHPUnit and Testing Specific Folders

The Less Stressful way to implement this technique

Do you want to test a specific folder in PHPunit? I have found a way to implement this feature more easily.

Podcasts for Laravel Developers

Podcasts for Laravel Developers

Boost your dev knowledge!

I have found podcasts are a great way to keep up to date with a lot of the latest information. I've compiled a list of a few I really like.

Level Up Your Arrays Using Objects

Level Up Your Arrays Using Objects

Objects as Containers for Easier Array Work

This is an optional technique that comes in handy when doing processing of arrays that may contain a lot of keys and is used for information storage or manipulation. We can refactor for better and easier understanding of code.

Limit Code Evaluation and Expressions in Your Blade Templates and Files

Limit Code Evaluation and Expressions in Your Blade Templates and Files

Remove these mistakes from your view files

Beginners often clog up their Laravel blade files with unnecessary "ifs", functions, variable assignments, and a host of other issues. We'll dive into why it's bad and how we can fix it.

The Single Best Tip for Writing Unit Tests

The Single Best Tip for Writing Unit Tests

The Anti-Zoolander Center for Developers Who Can't Test Good

A unit testing tip that will save you tons of time and effort inspired by Zoolander.

Laravel Commands Different Output Methods and Styles

Laravel Commands Different Output Methods and Styles

What Do They Each Look Like?

There are five command output methods. What do they look like in the CLI?

Stop Hardcoding Variables - Tricks to Avoid It

Stop Hardcoding Variables - Tricks to Avoid It

Avoid these beginner mistakes.

A mistake I see in a lot of beginner devs is hardcoding variables inside your code. This is not a good practice, and I see it all too often. Let's fix that and make our code cleaner.

Laravel Exceptions - Forwarding on Errors

Laravel Exceptions - Forwarding on Errors

Automatically Redirect the User When Thrown

Did you know that you can auto-forward on exception? Laravel makes this process incredibly simple and easy. An extremely useful trick!

Social Media & Cal Newport's "Any-Benefit" Mindset

Social Media & Cal Newport's "Any-Benefit" Mindset

When Are Things Worth it?

The "Any-Benefit" mindset says that something is absolutely worth a lot of your time, even if it provides next to no net benefit. We should rethink this and remove these essentially wasteful activities.

Working From Home as a Web Developer + Software Engineer

Working From Home as a Web Developer + Software Engineer

The Good and the Bad

I have now been working 100% remotely for a year. From this, I have gathered lots of knowledge about the pros and cons of this style of work. I'll attempt to lay them out as succinctly as possible.

Decorators and Laravel Pipelines with Multiple Parameters and Constructors

Decorators and Laravel Pipelines with Multiple Parameters and Constructors

An Alternative and Testable Way to Mutate Data with Laravel's Service Container

A Laravel specific trick sequentially manipulate data. Allows for testable pipelines that utilize the service container and multiple parameters and constructors.