Newsletter Archive

Should we write tests for this one-time command?

I'm a huge proponent of writing tests, but is there ever a valid time to skip them?

A good use case for the Eloquent sole() method

The sole() method has been around for a while, but I don't use it very much. Here's one place I found it useful.

The benefit of one-time commands

Is there any reason to build a Laravel command you only plan to use one time? Let's consider a few benefits.

Do we really need to build this feature?

Before diving into the code and cranking out a feature, sometimes it's useful to consider if we really need to build it at all.

Easily find specific code usages in PhpStorm without regex

Regexes in search logic are powerful, but this tip will supercharge your code searching without needing to get too fancy.

Understanding how Laravel view assertions work internally

No one likes a passing test when the actual logic is wrong. Here's how to make sure your view assertions are actually testing what you think they are.

Local history in PHPStorm

If you already have git, why would you use the local history feature in PHPStorm?

Be careful when using assertViewHas with null

Laravel's assertViewHas method doesn't work for null values. Here's how to test for them.

When to pull in top-level dependencies

If Laravel already requires a package, is there ever a reason to install it into your project directly?

Use GitHub issue templates to save time

Having a template not only makes issue creation easier, but also more consistent.

What if every Composer package had a fee?

An interesting thought experiment that might influence how many packages you pull into your project.

How to override PHPStorm file types

PHPStorm allows you to override the file type, giving you different syntax highlighting and auto-complete prompts.

When might you render a Blade template inline?

This isn't a feature I reach for frequently, but it's good to know it exists. Here is one use case where we found it quite handy.

How to make a bug fix way more valuable

Fixing bugs is important, but by taking just a little more time you can make your app much more resilient

Don't explicitly install dependencies if you don't need to

Pay attention to the dependencies Laravel or other packages are already bringing in. You may be pinning them to an older version without realizing it.

Take time to make things better

Look for opportunities to make things just a little bit nicer than you found them.

Tools should work for you, not boss you around

Ever have a day where you're "fixing the squiggles" in your editor and feel like the code got worse? Let's talk about how to avoid that.

Try not to make things worse

You know those parts of a codebase that feel "not great"? Be mindful to not further entrench those bad decisions.

Are fast queries always good?

I mean, yeah! Right? Well, there's more to the story...

Clean up dead git branch references automatically

When you merge a branch in GitHub, the reference to it is still in your local repo. How can you clean those up automatically?

A scenario using events and observers together

Sometimes it's useful to pair events and observers together. Let's look at one real-world example.

When should you use events and observers?

Laravel events and observers seem to do very similar things. So when would you use one over the other?

How do you know if something is slow in production?

The tools we used for finding slow code in development are not suitable for production. So how can we find slow code there?

Something slow? It's probably the database.

The absolute number one cause of slow code is the database. Laravel makes fixing some of the common issues very easy.

How do you know something is slow?

The first step in making your app faster is knowing what is slow. How do you figure that out?

What if you need a value that's random AND unique?

Sometimes we need random data that is ALSO unique. How can you generate that in Laravel?

Harness that post-conference excitement

New features! New packages! New techniques! How can we harness that excitement when we get back to work a conference?

Learn to love code review

Code review feedback might make us feel defensive, but if you approach it with the right attitude it can become something you value.

Find out what's slow BEFORE you deploy to prod

The earlier you find an issue, the better! How can we improve our chances of finding slow code before it reaches production?

Sometimes Eloquent can make a query slower

Eloquent improves developer efficiency, but in some cases it can make a query less efficient. Let's look at one example and how to fix it.
Want a tip like this in your inbox every weekday? Sign up below 👇🏼

Level up your Laravel skills!

Each 2-minute email has real-world advice you can use.