Laravel API Docs, Facades and Helper Functions

Laravel is a beautiful framework. So much thought and care went into writing it.

I'd always found myself stumbling upon some gems. Today I needed to recall a certain one, but I couldn't.

I went into to the Vendor folder, looking for a certain Request class which houses all the "hidden" methods. I found it under vendor/laravel/framework/src/Http/Request.php. And there I found my "ip()" which gets the client IP address.

request()->ip();

My journey or thought process that led it triggered a thought maybe all these methods are also documented in API docs - https://laravel.com/api/8.x/

And yes, there were.

This realisation made me understand the purpose and use of the API Docs.

This led to a re-read of the Architecture Concepts of the main docs.

In short, I figured that...

Every class called via the Use\Illuminate\x namespace can be looked up in the API docs for all its methods and usages, thus I don't need to travel the vendor folder of hell again. And I can discover new "hidden" methods faster.

Also, all Facades have a corresponding helper function. I have always known this, but it became clearer. Thus, all of the classes that powers the framework is available in a clean manner even in Blade via the helper functions.

It was a thrilling and interesting revealing.

And yet, I know I haven't even scratched the surface of the beautiful framework.
FUCK YOU! YOU CREATED A LARAVEL COLLECTION BEFORE ME???? lol i really am excited that you are writing about Laravel. I think it might be one topic you could write about daily for a long time.
2021-02-11 15:25:12

Laravel