Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

rushh's avatar
Level 1

API integration

i have to integrate , https://apidocs.shiprocket.in/?version=latest#fcf028f6-9d53-4eb3-adf1-91f395e0dbd6 this api in my eCommerce site which is in laravel

in this api , code is in PHP (cURL)

package is needed to install or not ? for cURL , and where i place this code in laravel in resource or controller ?

0 likes
3 replies
itsfg's avatar

For your API calls, I recommend using the package guzzle (http://docs.guzzlephp.org/en/stable/), it's much simpler to use than curl directly.

PS : you can't really say that code is in PHP here. This is a JSON API, you can interact with it with curl, and PHP implements functions make curl calls.

With guzzle you will write something like this to make a GET call :

$client = new GuzzleHttp\Client();
$res = $client->request('GET', 'https://apiv2.shiprocket.in/v1/external/shipments/'.$shipment_id);
$res->getBody() //get the body of the response, this will contain the data sent back by the API

Please or to participate in this conversation.