phpajaxlaravelguzzle

Laravel API Consumption


What is the best way of creating and consuming API in Laravel? I am writing the API with Laravel and testing with postman, but then I need to consume the API in the same project.

I am currently using Guzzle Client but I need another option.


Solution

  • Laravel does provide a wrapper around the Guzzle HTTP client.

    If you are making the API requests inside your controllers, this might be a better option, as it is more expressive than Guzzle.

    You can find more details here: https://laravel.com/docs/8.x/http-client