DEV Community

Priyank Patel
Priyank Patel

Posted on

Laravel Top Tip of the Week!

Hello Friends ! This is my top tips for sentient Laravel developers out there ! By the way, I will be sharing these top tips every week, so don't forget to follow me on @Twitter.

You must have been thinking why i must read these article when there are thousands of them out there on internet. But here we follow some structure to provide the top tips, and I have structured it in such a manner that the reader should be able to know WHEN TO USE IT.

Question/Situation - You want to know How to send more than one http request in Laravel? In other words, you want several requests to be dispatched at the same time instead of issuing the requests sequentially.

Answer - TopTip #1
You might think about running http requests concurrently to improve performance. The HTTP client's 'pool' method makes this a trivial exercise.

The pool method accepts a closure which receives an Illuminate\Http\Client\Pool instance, allowing you to easily add requests to the request pool for dispatching.

Here's how you can use it !

Laravel pool method code snippet

Final Thoughts - This was my first attempt on Dev.to and infact sharing something I feel is valuable and helpful for you people.

Top comments (0)