Black Friday: the Laravel testing course is $149 instead of $249, through Dec 7. See the course →
logo

More effective use of documentation

Don't get tunnel vision

Joel Clermont
Joel Clermont
2025-01-30

From our daily Laravel tips email. Get the next one in your inbox.

One of the things about writing these tips each day is that my mind has started to think in terms of "tips" any time I solve a problem or help someone else.

So I'm going to keep going on the thread regarding the uniqueness in factories and extract one more tip from that story.

This time I want to talk about effective use of documentation.

One interesting thing to note about our uniqueness solution with factories is that you would be hard-pressed to find it in the Laravel docs.

If you search on "unique" in the Laravel docs, you would find zero results that lead to the factories section. And if you read the factories section completely, the only mention you'd see is a code sample that uses unique().

But we have to keep in mind that while Laravel provides the way to create factories, it pulls in the Faker library to generate the data. So we're leaving ourselves a huge blind spot if we don't also check Faker's own docs.

There are other examples of this: PHPUnit, Mockery, Carbon, and so on.

Sometimes the lines are blurred, like PHPUnit, where Laravel provides quite a few helpers on top of what PHPUnit offers, so we may have to check both places to get a feel for what is from PHPUnit and what is from Laravel.

My main point is that as good as Laravel's docs are (and they are great!), don't overlook the underlying libraries and use their docs as well.

Here to help,

Joel

P.S. Maybe you feel like you're slammed on a deadline and don't have time to mine docs to find an answer. I get it, and we can help.

Want a tip like this in your inbox every weekday?

Each one takes less than 2 minutes to read. Join 4,000+ Laravel developers who already get them.

email
No spam. Only real-world advice.
Toss a coin in the jar if you found this helpful.