What the F*ck Is With All the Artisan Commands: Queues

Work queues allow you to perform tasks that are slow or error-prone outside of the current user’s request to improve their experience with your site. Read on to learn how you can use work queues in Laravel for your projects.

Read More

Link Post and Podcast Roundup: March 2020 Edition

March’s links.

Read More

Installing Existing VS Code Extensions on a New Computer

I recently purchased a new computer and realized there isn’t an easy way in the VS Code GUI to get a list of all of your installed extensions. I was able to find a way to do it using the command line.

Read More

What the F*ck Is With All the Artisan Commands: Route Commands

There are three route commands that we need to quickly cover in order to be completionist in this process of going over every artisan command.

Read More

What the F*ck Is With All the Artisan Commands: Seeders

Now that we have discussed creating factories, we can look at how to use these factories to seed our database with test data.

Read More

Link Post and Podcast Roundup: February 2020 Edition

Link Post Logo

February’s links.

Read More

What the F*ck Is With All the Artisan Commands: Factories

Now that we know how to create tests, it’s time we looked at how we can use factories to generate test data quickly and easily.

Read More

Our New Mailing List!

Our New Mailing List Header Image

We’ve started a new mailing list to communicate new content and links to the community. You can sign up using the form below. We don’t like having our inbox filled up with SPAM so you can be assured that we won’t be sending you any. 😆


* indicates required

View previous campaigns.

Linting All Your PHP Files

The Problem

The PHP CLI has a cool feature (-l) that allows you to check a file to see if it has any syntax errors:

scotts-air:~ scottkeckwarren$ php -l test.php 
Parse error: parse error, expecting `"function (T_FUNCTION)"' in test.php on line 5
Errors parsing test.php

The downside to this is that it doesn’t work on a whole directory. So unless you’re willing to add every new file to a script it’s not a quick way to check all your files before deployment.

The Solution

With some command line magic we can have it run on all the PHP files in our application:

find -L application -name '*.php' -print0 | xargs -0 -n 1 -P 4 php -l

I find it helpful to run my template files through this process as well:

find -L application -name '*.phtml' -print0 | xargs -0 -n 1 -P 4 php -l 

Converting Laravel 6.x Migrations to MySQL

Laravel Logo

I’ve had trouble knowing what to put in my migrations’ up() and down() functions. The Laravel Docs include a lot of information but I wanted a quick reference guide for myself to convert Laravel migrations to MySQL commands because that’s what I’m used to. :-)

I also spend some time compiling this into a Cheetsheet if you want a printable version of this post.

Read More

Join Our Mailing List!

View previous campaigns.

subscribe via RSS

All content copyright This Programming Thing 2012 - 2020
Blogging about PHP, MySQL, Zend Framework, MySQL, Server Administration and Programming in general