PHP code example of seshac / laravel-shiprocket-api
1. Go to this page and download the library: Download seshac/laravel-shiprocket-api library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
seshac / laravel-shiprocket-api example snippets
return [
/*
|--------------------------------------------------------------------------
| Default Shiprocket Credentilas
|--------------------------------------------------------------------------
|
| Here you can set the default shiprocket credentilas. However, you can pass the credentials while connecting to shiprocket client
|
*/
'credentials' => [
'email' => env('SHIPROCKET_EMAIL', '[email protected]'),
'password' => env('SHIPROCKET_PASSWORD', 'password'),
],
/*
|--------------------------------------------------------------------------
| Default output response type
|--------------------------------------------------------------------------
|
| Here you may specify which of the output response you need.
|
| Supported: "collection" , "object", "array"
|
*/
'responseType' => 'collection',
];
use Seshac\Shiprocket\Shiprocket;
.
.
.
$loginDetails = Shiprocket::login([
'email' => '[email protected]',
'password' => 'example'
])
// if you added credentials at shiprocket.php config file no need to pass credentials
use Seshac\Shiprocket\Shiprocket;
.
.
.
$token = Shiprocket::getToken();// if you added credentials at shiprocket.php config
$productDetails = [
// refer above url for reate($productDetails);
$response = Shiprocket::ndr($this->token)->getShipments();
// EX : GET : https://apiv2.shiprocket.in/v1/external/ndr/all where you can get all the shipments that are in NDR.
$awb_code = '0212331233322';
$response = Shiprocket::ndr($this->token)->getSpecificShipment($awb_code);
// GET : https://apiv2.shiprocket.in/v1/external/ndr/{AWB} Where you can information of specific AWB which is in NDR