logo
podcast Podcast
get help Get Unstuck

Master laravel Laravel with hand-curated and expertly written Daily tips

We're excited to share a daily email with you that you can read in less than 2 minutes. Oh, and if daily is too often - don't worry - you can opt into weekly digests instead.

email
No spam. Only real-world advice you can use.
quote

I've been subscribed to this newsletter for less than a week, and I already received some advice that I was able to instantly implement into my daily work.

Samuel Pedraza
Samuel Pedraza
Laravel Developer

Daily Tips Archive

We've been cranking out tips for a while now. Can you believe there are 333 of them?! Keep on scrolling to see what you may have missed below.

2024-11-21

How do strict types work if only enabled in some files?

One simple rule to remember
2024-11-20

Have one GitHub Action trigger another

It doesn't work by default
2024-11-19

How are duplicate routes resolved?

Order is important
2024-11-18

How to deal with things outside your control

Estimates are hard enough already
2024-11-15

More flexible assertions for mock calls

But still providing test confidence
2024-11-14

Make PHPStorm aware of your custom Blade directives

Don't put up with those red squiggly lines
2024-11-13

How can you make sure the environment is configured correctly?

Avoid silent failures
2024-11-12

Another reason to like named routes

It keeps getting better
2024-11-08

Get rid of the squiggles

Don't become numb to IDE noise
2024-11-07

What about the action helper?

Better than named routes?
2024-11-06

Always use named routes

Future developers will thank you
2024-11-05

Don't forget this when writing mock assertions

Or it might pass when it shouldn't
2024-11-04

Should we use a JSON field for this?

Database design is important
2024-11-01

Connecting to a git repo through a SOCKS proxy

Sometimes it has to be done.
Book cover for A Little Bit of Laravel

Prefer a little bit more meat with your tips?

You're in luck! This ebook contains tips and tricks that are quick and easy to apply but make a noticeable improvement in any Laravel app. Dig in a little bit deeper with larger code samples and deeper explanations.

Get your FREE Laravel tips book up right

October, 2024

2024-10-31

Connecting to a git repo through an SSH tunnel

SSH config is your friend
2024-10-30

Where should you put extra config values?

Make future Laravel upgrades easier
2024-10-29

Export all routes to a spreadsheet

Businesses love spreadsheets
2024-10-28

Make it easier to debug GitHub Actions

Get better failure output
2024-10-25

Not all databases run migrations the same

Definitely good to understand
2024-10-24

A good use for `mergeIfMissing`

Simplify forms with optional sections
2024-10-23

Part 2: What is the best framework for a super small task?

Lumen? Slim? Symfony?
2024-10-22

What is the best framework for a super small task?

Part 1: How about Laravel?
2024-10-21

A balanced approach to static analysis in Laravel apps

Don't just take orders from a tool
2024-10-18

Refactoring toward a longer-term goal

When one big change is too much
2024-10-17

Minimizing risk with production data migrations

Measure twice, cut once
2024-10-16

Just do it the right way

It will probably take less time too
2024-10-15

Why I don't use `dropIfExists` in down methods

Assuming you even have a down method
2024-10-14

A use case for the `value-of` PHPDoc type

Catch more errors with specific types
2024-10-11

What is an integration test?

A little off the beaten path
2024-10-10

What is a unit test?

And when would I use one?
2024-10-09

What is a feature test?

And how should I organize my tests?
2024-10-08

Additional thoughts about the `observedBy` attribute

Another reason you might choose to use it
2024-10-07

Why do we like testing so much?

We talk about it a lot, I know
2024-10-04

Why we keep the testing database separate

A huge improvement
2024-10-03

Easily generate a bigger collection

Useful for quick experimentation
2024-10-02

A very useful tool for managing Node versions

Been using it for over a year now
2024-10-01

Should you run `optimize` with Vapor?

I didn't see this in the docs

September, 2024

2024-09-30

A small gotcha with the `observedBy` attribute

And how to avoid it
2024-09-27

How would you override a URL in a command?

And why would you even want to?
2024-09-26

An important fix for composite primary keys

Another reason to keep Laravel up to date
2024-09-25

Appreciating code by using it

See it in a whole new light
2024-09-24

Making better use of docblocks

An improvement on a previous tip
2024-09-23

What does it mean to 'know' something?

Words are hard
2024-09-20

Avoid surprises with factory relationships

Do you need all those records?
2024-09-19

Default factories should do as little as possible

Another time laziness pays off
2024-09-18

Don't overthink your application architecture

The defaults get you very far
2024-09-17

The right way to upgrade Laravel

More than running composer update
2024-09-16

Better types in API resources

And very simple to do
2024-09-13

Route method order matters in certain cases

Another one I learned the hard way
2024-09-12

API resources behave differently if you have a data property

This had me confused for a bit
2024-09-11

An actual bug related to CPU architecture

I knew I wasn't paranoid
2024-09-10

Tell a story with your git commits

It doesn't have to be a long story
2024-09-09

How to approach being wrong

Make the most of the situation
2024-09-06

Is Apple Silicon going to shoot me in the foot?

I might be a bit paranoid
2024-09-05

Better assertions for things that happen more than once

Laravel has you covered
2024-09-04

Look for opportunities to group routes

It's not just about fewer lines of code
2024-09-03

Make the most of your project README

Help out a future dev
2024-09-02

A slightly vague validation error

It tripped me up for a little bit

August, 2024

2024-08-30

Why do you need reflection with attributes?

And isn't reflection "bad"?
2024-08-29

A little bit more on PHP attributes

How do they work?
2024-08-28

Thinking out loud about field lengths

I don't have all the answers
2024-08-27

Strengthen your tests by being negative

Not that kind of negative
2024-08-26

Where do you go when you need help?

No one knows it all
2024-08-23

Start with the simple test

You don't have to test everything at once
2024-08-22

Static analysis versus Laravel conventions

Sometimes they don't play well together
2024-08-21

A technique for testing legacy code

Which is seldom well-behaved
2024-08-20

How should you document API permissions?

It depends on the audience
2024-08-19

Why we assert specific validation error messages

Are you testing what you think you are?
2024-08-16

When is a stream download not a stream?

A slight correction to a previous tip
2024-08-15

What do these three dots mean?

Keeping up with newer PHP syntax
2024-08-14

When does route model binding happen?

Understanding this helps with troubleshooting
2024-08-13

A simpler approach to testing policies

And the tests are a little faster too
2024-08-12

What does it mean if someone says your app is slow?

Can you be more specific?
2024-08-09

What makes a test valuable

It's not a metric like coverage
2024-08-08

How we name validation tests

I don't see others doing this
2024-08-07

Get more specific when asserting events dispatched

More confidence and better errors
2024-08-06

Sync queue works differently than async

Another time I learned the hard way
2024-08-05

Some unexpected behavior with times in Carbon

As always, it pays to be explicit
2024-08-02

One time echo versus print made an actual difference

Unlike tabs versus spaces
2024-08-01

Why we have a separate test suite for external services

Speed is good, but not the whole answer

July, 2024

2024-07-31

Should all request data in tests be strings?

Tests should act like the real world
2024-07-30

What do I put in my base test class setup method?

They aren't completely empty
2024-07-29

How to customize the message for enum validation

It wasn't completely obvious to me
2024-07-26

How I like to set up application seeders

This approach has worked well for me
2024-07-25

How to customize the database notification model

Not documented, but very simple
2024-07-24

Sharing a model between landlord and tenant

A little tricky in a multi-database environment
2024-07-23

Use global test setup methods sparingly

Seems like a good idea at first, but...
2024-07-22

Simplifying webhook client responses

Especially useful with high volume projects
2024-07-19

Write command tests in a consistent way

Have one way of doing things
2024-07-18

API specs are not just for giant teams

Or external users
2024-07-17

What does Laravel clean up after each test?

Save yourself some work
2024-07-16

When would you use validation attributes?

Very useful in specific circumstances
2024-07-15

How to enforce all API requests are JSON

Cut down on confusion and support requests
2024-07-12

The importance of running CI checks locally

Don't wait for some remote pipeline to catch your mistakes
2024-07-11

How to enforce max payload size in validation

Not as simple as using a built-in rule
2024-07-10

What is the difference between Eloquent array and JSON casts?

When would you use one over the other?
2024-07-09

Why does auto-complete not work for GitHub mentions?

Super annoying when it happens
2024-07-08

Why I don't like generating API specs

Even though it would be a lot quicker
2024-07-05

How to test an observer is wired up

If it isn't, then no other logic tests matter
2024-07-04

Slowly introducing static analysis without changing everything

It doesn't have to be all or nothing
2024-07-03

How to get started writing an API spec

Slow and steady without getting overwhelmed
2024-07-02

The benefits of writing an API spec

Not just for external users
2024-07-01

Generating slugs in factories

Cleaner than it sounds...

June, 2024

2024-06-28

Automatically generate label from enum name

What happens when you need more than name and value?
2024-06-27

sprintf is the single most valuable tool that you probably aren't using

It is a string-formatting beast!
2024-06-26

Why I rarely use Laravel mailables anymore

My use of outgoing emails is still strong as ever, though.
2024-06-25

Making third-party validation look like your own

A good user experience also may be easier to code
2024-06-24

If you're in a loop you may implode

It's actually better than it sounds
2024-06-21

How to ignore a filter for one policy method

A couple approaches
2024-06-20

Troubleshooting an empty session

The importance of knowing your tools
2024-06-19

Refactoring logic into a policy method

So much nicer
2024-06-18

Making sure tests don't reach the outside world

Keep things fast and stable
2024-06-17

Why we use phpunit.xml

Instead of different env files
2024-06-14

How do you set a specific starting auto-increment value?

Can we do it without raw SQL?
2024-06-13

Why use a form request with no rules?

What else is it good for?
2024-06-12

Our rule for ordering controller action parameters

With an explanation as to why
2024-06-11

What is the difference between localhost and 127.0.0.1?

And when does it matter?
2024-06-10

Should you publish package migrations?

And why does it matter?
2024-06-07

Using a trait to communicate intent

Don't make future devs guess
2024-06-06

Magic methods are okay in the right context

We're reasonable about it
2024-06-05

Does this page really need CSRF protection?

Most of the time, the answer is yes
2024-06-04

Better command line diffs for git

Easier to read and understand
2024-06-03

How we test external APIs

Without slowing down our normal test suite

May, 2024

2024-05-31

How do you test code you don't understand?

And without tests, how could you ever change it?
2024-05-30

Why we don't queue password reset emails

Faster responses aren't always better
2024-05-29

A nuanced opinion on validating URL request parameters

What error code should you use?
2024-05-28

Add a feature to a package without forking or hacking

Laravel is so flexible
2024-05-27

Don't use the config helper in a config file

Unless you like empty config values
2024-05-24

A change in PHP 8 that affects Laravel tests and transactions

The error was there all along...
2024-05-23

Should you let your admin do that?

Maybe admins shouldn't have access to everything
2024-05-22

What do you need to clean up after your tests?

Maybe less than you think
2024-05-21

Disabling Composer timeout with nested scripts

Useful for long-running CI pipelines
2024-05-20

How do you discover interesting new packages?

Here's a great resource
2024-05-17

Read the docs for that package

It doesn't even take that long
2024-05-16

Order of operations with null coalesce

This can be sneaky
2024-05-15

How to detach a fork from your GitHub repo

This should be more obvious
2024-05-14

Avoid logic inside your test

Hard-coding things is okay
2024-05-13

How to set an env variable within a Composer script

And why you might want to do it
2024-05-10

An easy way to merge long-running branches in GitHub

One button click away
2024-05-09

Don't get overwhelmed by errors in your application

Or put your head in the sand
2024-05-08

Should a factory always define a required field?

Sometimes a little extra manual work makes for a better test
2024-05-07

Dealing with name collision in different namespaces

Optimize for simplicity
2024-05-06

Using Cloudflare to set up simple email forwarding

And it doesn't cost anything
2024-05-03

Why I always type-hint route parameters

A fun little riddle
2024-05-02

Another helpful use for local history

Related to testing
2024-05-01

Conferences are more than just talks

They've had a huge impact on my career

April, 2024

2024-04-30

Avoid some common Composer dependency issues

Save yourself from a future surprise
2024-04-29

How to detect and safely remove dead code

Don't just ignore it
2024-04-26

You will never get everything done

And that's ok
2024-04-25

Does it matter how your code looks?

It's not just about aesthetics
2024-04-24

Is now the right time to clean up this data?

Keep a realistic outlook
2024-04-23

Using the stricter assertSame check with collections

Without making the test more complex
2024-04-22

Should this be a collection or an array?

Use the right tool for the job
2024-04-19

A strategy for testing permissions logic

And avoiding false positives
2024-04-18

Easier test coverage for complex API resources

And the tests are fast too
2024-04-17

Rate limiting down to the second

Important for high-traffic applications
2024-04-16

Adding rules to an extended form request

It's all just arrays
2024-04-15

What is the difference between the asset helpers?

And which one should you use?
2024-04-12

What is the longest valid email address?

And how does this impact validation rules?
2024-04-11

The life cycle of database hosting

Start simple and grow as needed
2024-04-10

Preventing performance surprises with Laravel migrations

Keep your system healthy
2024-04-09

Is there a performance penalty in MySQL for inserting a column?

The answer is nuanced
2024-04-08

Passing arguments to a partial mock's constructor

You can't use Laravel's mock helper
2024-04-05

Avoid unnecessary work when querying relationships

Keep your database happy
2024-04-04

How would you test code that uses the `old()` helper?

And why you might want to
2024-04-03

A better way to schedule commands

Avoid magic strings
2024-04-02

Partial mocks don't run constructors

At least by default...
2024-04-01

How to troubleshoot S3 filesystem issues

Silent failures are the worst

March, 2024

2024-03-29

Understanding how caching works in GitHub Actions

Keep CI running fast
2024-03-28

Are you really going to need that abstraction?

No really, are you sure?
2024-03-27

Forcing all API requests to accept JSON

Avoid annoying errors
2024-03-26

How to use Pusher with private encrypted channels

Important when dealing with sensitive data
2024-03-25

An easy way to test UUIDs

Laravel has you covered
2024-03-22

Understanding the order of authorization and model binding

And why you shouldn't just flip the order
2024-03-21

A trick for geolocating US postal codes

It's dumb, but it works
2024-03-20

How to step debug a queued job

For those times when dd is not enough
2024-03-19

Cleaning up deprecated warnings during a database migration

Don't ignore it
2024-03-18

Monitoring progress of a big database import

Without this, it feels like it takes forever
2024-03-15

A good rule for when to create a factory state

Make your tests more readable
2024-03-14

Should you change app code for a test?

It depends on why you're changing it
2024-03-13

Loading a SQL backup without altering your configuration

Sometimes data is messy
2024-03-12

Why I always add a primary key to many-to-many tables

Even when Laravel doesn't require it
2024-03-11

Make sure your listeners are wired up

Without this simple test, nothing else matters
2024-03-08

How to set CORS headers for built assets

And do it efficiently
2024-03-07

Something to know if serving scripts for other sites

Especially if you moved to Vite
2024-03-06

Loading relationships inside a queued job

Do it the Laravel way
2024-03-05

A better way to drop a unique index

It involves less guesswork
2024-03-04

Why pagination sometimes has overlapping pages

A deeper look inside the database
2024-03-01

Sharing redirect logic between controller actions

Without resorting to messy hacks

February, 2024

2024-02-29

What is the point of design patterns?

And have you fallen asleep yet?
2024-02-28

Manual testing still has its place

Put yourself in the shoes of your users
2024-02-27

Ignoring files per environment with Docker

And why you might want to do this
2024-02-26

Quickly viewing test file structure

Another reason I like patterns
2024-02-23

Picking a good test value

And avoid flaky tests
2024-02-22

Pay attention to analytics

There can be some interesting insights
2024-02-21

Consistent test organization

I like patterns
2024-02-20

How we use migrations during early product development

When the schema changes quickly
2024-02-19

Simple rules for writing authorization logic

A little bit of structure goes a long way
2024-02-16

One place I avoid constructor property promotion

Just to keep the intent clear
2024-02-15

Move that logic out of your view

How much is too much?
2024-02-14

Alpha validation might not be doing what you think

It certainly surprised me the first time I bumped into it
2024-02-13

Avoid changing your code purely for a test

Even if it's just to make a property public
2024-02-12

Get better auto-complete from your factories

And reduce the need for @var docblocks
2024-02-09

Watch out for this when testing Artisan commands

A weird reason for a failing test
2024-02-08

A clean approach to testing events and listeners

Focus on what each thing should do
2024-02-07

Another reason I like fillable instead of guarded

Every little bit helps
2024-02-06

A safer way to check model strictness in production

Without annoying your users
2024-02-05

Why does Laravel offer a max password length validation rule?

Doesn't hashing make this irrelevant?
2024-02-02

Composer scripts and Valet isolate

Something to be aware of
2024-02-01

Is it worth switching to another tool?

And how do you know when it's the right time?

January, 2024

2024-01-31

Being explicit when something should not queue

A simple way to clearly communicate intent
2024-01-30

Absolute paths and the Vite asset helper

Want to laugh at me? It's ok.
2024-01-29

Don't become numb to pain in your project

You can make it better!
2024-01-26

Why might you want to forget a route parameter?

And how does it work?
2024-01-25

Inspecting files in a Docker container

And easily spotting what changed
2024-01-24

Considerations when cleaning up a big table

Without causing downtime or making production slow
2024-01-23

A measured approach to using Larastan

More isn't always better
2024-01-22

How to test that a model wasn't changed

In a very simple way
2024-01-19

Running HTTP requests right inside your editor

I promise I'm not getting paid by JetBrains
2024-01-18

How we use seeders in our application

And why we rarely use them for testing
2024-01-17

Another nice feature for local pull request review

It's even nicer than GitHub's UI
2024-01-16

Eager loading, but only if you really need to

Since we want to reduce the number of queries
2024-01-15

Route binding with two different models

While still leveraging the framework
2024-01-12

Stop using $request->get()

There is a better way
2024-01-11

Don't reinvent features that Laravel already has

For example, soft deletes
2024-01-10

Vite Hot Module Replacement and setInterval

And a workaround if you really need one
2024-01-09

What is the difference between boot and register in service providers

Where do I put this code?
2024-01-08

Even GitHub comments have version control

And it occasionally helps you win arguments
2024-01-05

Failing tests give you confidence

Not just knowing it fails, but why
2024-01-04

Don't just get mad at some tech, dig in and learn

Once you learn it, then you can complain
2024-01-03

Use factories to make your tests more readable

Only include relevant details in your test setup
2024-01-02

One situation where it is useful to make more than one request in a test

Don't abuse this, but here's one case I think is okay
2024-01-01

Using factories with more than one relationship

Sometimes you can't follow the typical naming convention

December, 2023

2023-12-29

Redirect routes match all HTTP verbs

If you need to be more precise, here's a better way
2023-12-28

Routes resolve differently when cached

But tests can help you catch the issue
2023-12-27

The benefits of caching in CI

And it's not for performance reasons
2023-12-26

Don't cache routes or views locally

Great for production, but trouble for development
2023-12-25

View source always makes a new request

I forget this like once a year
2023-12-22

How clear coding rules can free up your team

Have the debate once, then move on
2023-12-21

Making a case for consistency

And the importance of a good README
2023-12-20

Why the nullable validation rule is useful

Sometimes code is for your team, not just the PHP runtime
2023-12-19

Why we don't use SQLite for tests

Faster isn't always better
2023-12-18

When it might be ok to use a mixed type

It serves a useful purpose
2023-12-15

Using writing to think through a problem

This has saved me many times when I felt stuck
2023-12-14

Are you writing script definitions in Composer?

If not, we highly recommend it!
2023-12-13

Why we don't use return types on controller actions

But we do like return types in general!
2023-12-12

How to route based on the requested domain

Very useful if you serve multiple sites out of the same Laravel app
2023-12-11

Keep your testing database separate from development

Understanding how phpunit.xml works opens up many possibilities
2023-12-08

Don't rely on key ordering with MySQL JSON values

This behavior caught me by surprise
2023-12-07

Different approaches to upgrading to a new major Laravel version

And we explain the pros and cons of each
2023-12-06

Be consistent with composer scripts in CI

Keep it simple and save yourself some trouble
2023-12-05

Why we like minimal seeders for tests

Getting this right will make your tests so much easier to maintain
2023-12-04

You don't need to manually run seeders in your tests

Laravel is constantly making things nicer
2023-12-01

A surprising issue with the Auth user and tests

Knowing how this works helps you avoid false failures in your tests

November, 2023

2023-11-30

Lazy loading protection does not catch all N+1 queries

I discovered this one the hard way
2023-11-29

Should you be able to override coding standards locally?

And why am I even asking this question?
2023-11-28

A simple approach to localization using middleware

We used this on a recent project and it worked great.
2023-11-27

How to rate limit by IP behind a Cloudflare proxy

If you don't do this, your app could actually start blocking Cloudflare traffic.
2023-11-24

Don't take it personal if your contribution is rejected

You had a good idea and submitted it, but then the project rejects it. Now what?
2023-11-23

Maybe you don't need to write code this time

And using a no-code tool may even give you more empathy for users of your app
2023-11-22

How to reference a PHP CodeSniffer ruleset in EasyCodingStandard

This simple addition can make it much easier to migrate between tools
2023-11-21

How does LetsEncrypt work behind Cloudflare?

If we use a proxy like Cloudflare, will it impact our ability to issue LetsEncrypt certificates?
2023-11-20

Considerations when eager loading resource collections

Check out a subtle bug that avoided notice for a while, and how tests eventually helped us.
2023-11-17

The right way to fix double encoding in Blade components

There is a lot of bad advice out there on this topic. Here's a better approach.
2023-11-16

Version untracked files with PhpStorm

Another very handy use for PhpStorm's Local History feature
2023-11-15

Enforcing Horizon auth in local

Is this overkill? Or does it give you more confidence in your application?
2023-11-14

Cloudflare, Laravel, and TLS

Double check this setting to save yourself some trouble
2023-11-13

A good rule around "down" migrations

Some would say don't bother to write "down" migrations. I argue that if you do, you should follow this rule.
2023-11-10

Use the right tool for the job

You can still have your favorite, but it's good to see what else is out there
2023-11-09

Should you manage roles and permissions with a UI?

It's tempting to let non-developers manage this data, but is it a good idea?
2023-11-08

Understanding how Laravel sessions work

If we don't know how something works, it's more confusing when things behave differently than expected.
2023-11-07

Using workarounds without creating a mess

Sometimes a workaround is unavoidable, but how can you avoid them from piling up technical debt?
2023-11-06

Dealing with messy JSON

Sometimes API do unspeakable things and we have to work around it in our app
2023-11-03

The value of a quick code demo

Sometimes it's more effective to show than tell
2023-11-02

Don't get defensive during code review

Sometimes even a small observation can lead to a big improvement
2023-11-01

How to assert a Laravel job is delayed

I've seen a lot of convoluted approaches to this, here's a drop-dead simple way to do it.

October, 2023

2023-10-31

Ever need a different git setting per repo?

Maybe you have one git account for work, and one for open source. How do you make sure the right author is used in each repo?
2023-10-30

Keep your code consistent

Ever find 5 different ways of doing something in a single codebase? Here's an approach to minimize that.
2023-10-27

How to get rid of HEIC files in your app

And it makes your app easier to use for non-iPhone users too
2023-10-26

The changing value of books throughout your career

Perhaps that book you thought was useless 5 years ago is exactly what you need today.
2023-10-25

Actually read the whole error message

This seems really simple and obvious, but I've been burned in the past not doing this myself.
2023-10-24

How much detail should you include in error messages?

Error messages are part of user experience.
2023-10-23

Is it time to abstract this?

You spot two things in your app that are mostly the same. Is that an automatic refactor?
2023-10-20

How do you test middleware?

Middleware can be a tricky thing to test. Here's what I did in a recent project.
2023-10-19

Document before automating

As devs, sometimes we rush to coding a solution. But there's an important step that should come first.
2023-10-18

A simple way to avoid multiple lookups within a request

Traditional caching comes with its own set of complexities. Here's a simple way to use basic PHP instead.
2023-10-17

Joins in Eloquent? How?

Sometimes you need a join for performance or sorting by relations. Here's a way to do that without giving up Eloquent.
2023-10-16

Ship something every day

There's value in shipping something, anything, at least once a day, even on a bigger feature.
2023-10-13

Is sleep in a test always bad?

You might think adding sleep to a test is a dirty hack, but it's not always a bad thing.
2023-10-12

Some reasons to write a down method in your migrations

And it's probably not the reason you think.
2023-10-11

Use custom Mockery matchers for better Laravel assertions

Clean up your tests, especially when passing models as arguments
2023-10-10

What does INT(11) mean in MySQL?

Here's a hint: it has nothing to do with length
2023-10-09

How do you insert a new column at the beginning of a MySQL table?

And more importantly, why would you want to?
2023-10-06

Be careful ordering columns in a migration

Laravel migrations let us insert a column in a specific position in a table, but it's not always a good idea.
2023-10-05

Applying a class to a Markdown link

Ever wish you could add a CSS class to a Markdown link? Here's how I did it.
2023-10-04

Don't forget to pin PECL extensions

We pin Composer packages and PHP versions, but what about PECL extensions?
2023-10-03

How to make the AWS SDK much smaller

Only need a small portion of the AWS SDK, and wish you could make it a lot smaller?
2023-10-02

Do you really need to install that SDK?

If you're integrating with a third-party API, you may not need to bring in a giant SDK.

September, 2023

2023-09-29

Cache Larastan results in Github Actions

Larastan is a great tool, but it can slow down your CI pipeline. Here's how to cache the results to make each run faster.
2023-09-28

Managing a micro-manager

It's frustrating to have a client or co-worker attempt to micro-manage you. We share some tips on how to make the working relationship better.
2023-09-27

Drop unneeded steps in CI

This might seem pretty obvious, but it's easy to forget to remove steps from your CI pipeline when they are no longer needed.
2023-09-26

Keep your Laravel CI pipeline running fast

CI pipelines tend to get slower over time, the more we add to them, and the bigger our project grows. Keeping an eye on this is important.
2023-09-25

Knowing when to keep it simple

We take pride in building things "the right way", but there is a balance to strike with simplicity.
2023-09-22

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?
2023-09-21

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.
2023-09-20

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.
2023-09-19

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.
2023-09-18

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.
2023-09-15

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.
2023-09-14

Local history in PHPStorm

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

Be careful when using assertViewHas with null

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

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?
2023-09-11

Use GitHub issue templates to save time

Having a template not only makes issue creation easier, but also more consistent.
2023-09-08

What if every Composer package had a fee?

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

How to override PHPStorm file types

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

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.
2023-09-05

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
2023-09-04

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.
2023-09-01

Take time to make things better

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

August, 2023

2023-08-31

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.
2023-08-30

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.
2023-08-29

Are fast queries always good?

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

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?
2023-08-25

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.
2023-08-24

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?
2023-08-23

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?
2023-08-22

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.
2023-08-21

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?
2023-08-18

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?
2023-08-17

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?
2023-08-16

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.
2023-08-15

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?
2023-08-14

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.
Don't miss out - get a tip like this in your inbox every weekday? Sign up below 👇🏼
email
No spam. Only real-world advice you can use.