PHP code example of abdulsalamishaq / sendbox

1. Go to this page and download the library: Download abdulsalamishaq/sendbox 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/ */

    

abdulsalamishaq / sendbox example snippets




// This file is generated by Composer
ate a new Client instance
$client = new Client('{access_token}');

// Create a new Client instance and set options
$client = new Client('{access_token}', [
            'app_id' => '{app_id}', 
            'client_secret' => '{client_secret}',
            'refresh_token' => '{refresh_token}',
        ]);

$client->shipment->getShipments();



// This file is generated by Composer
t = new Client('{api_key}');

$client->shipment->getShipments();




// This file is generated by Composer
t = new Client('{api_key}');

$client->shipment->getShipments('{shipment_id}');




// This file is generated by Composer
t = new Client('{api_key}');
$quote = [
    "origin_name" => "Mrs. Hippo",
    "origin_phone" => "+2348170441446",
    "origin_street" => "Clayton St.",
    "origin_city" => "Ikorodu",
    "origin_country" => "NIGERIA",
    "origin_country_code" => "NG",
    "origin_state" => "Lagos",
    "origin_state_code" => "LOS",
    "destination_name" => "Brian",
    "destination_phone" => "+2348170441446",
    "destination_street" => "Drydock Ave Suite 610",
    "destination_city" => "Ikeja",
    "destination_country" => "NIGERIA",
    "destination_country_code" => "NG",
    "destination_state" => "Lagos",
    "destination_state_code" => "LOS",
    "weight" => "0.5",
    "items" => [
        [
            "name" => "Test Brian Iyoha",
            "quantity" => "1",
            "weight" => "1",
            "amount" => "100",
            "value" => "120000"
        ]
    ]
];

$client->shipment->quotes($quote);




// This file is generated by Composer
t = new Client('{api_key}');

$createShipment = [
    "origin_name" => "Mrs. Hippo",
    "origin_phone" => "+2348170441446",
    "origin_street" => "Clayton St.",
    "origin_city" => "Ikorodu",
    "origin_country" => "NIGERIA",
    "origin_country_code" => "NG",
    "origin_state" => "Lagos",
    "origin_state_code" => "LOS",
    "destination_name" => "Brian",
    "destination_phone" => "+2348170441446",
    "destination_street" => "Drydock Ave Suite 610",
    "destination_city" => "Ikeja",
    "destination_country" => "NIGERIA",
    "destination_country_code" => "NG",
    "destination_state" => "Lagos",
    "destination_state_code" => "LOS",
    "weight" => "0.5",
    "items" => [
        [
            "name" => "Test Brian Iyoha",
            "quantity" => "1",
            "weight" => "1",
            "amount" => "100",
            "value" => "120000"

        ]
    ],
    "selected_courier_id" => "rate_key_86a68758ead65de840b8f3e8e235a18f",
    "channel_code" => "api"
];

$client->shipment->create($createShipment);




// This file is generated by Composer
t = new Client('{api_key}');

$client->shipment->addresses()




// This file is generated by Composer
t = new Client('{api_key}');
$client->payment->profile()