A simple Object Oriented PHP Client for Sendbox SMS API.
Uses Sendbox API.
- PHP ^8.0
- Guzzlehttp ^7.0
Via Composer.
composer require abdulsalamishaq/sendbox
<?php
// This file is generated by Composer
require_once __DIR__ . '/vendor/autoload.php';
use AbdulsalamIshaq\Sendbox\Client;
// Create 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();
Uses Shipments.
<?php
// This file is generated by Composer
require_once __DIR__ . '/vendor/autoload.php';
use AbdulsalamIshaq\Sendbox\Client;
$client = new Client('{api_key}');
$client->shipment->getShipments();
Uses Shipment.
<?php
// This file is generated by Composer
require_once __DIR__ . '/vendor/autoload.php';
use AbdulsalamIshaq\Sendbox\Client;
$client = new Client('{api_key}');
$client->shipment->getShipments('{shipment_id}');
Uses Request quotes.
<?php
// This file is generated by Composer
require_once __DIR__ . '/vendor/autoload.php';
use AbdulsalamIshaq\Sendbox\Client;
$client = 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);
Uses Create new shipment.
<?php
// This file is generated by Composer
require_once __DIR__ . '/vendor/autoload.php';
use AbdulsalamIshaq\Sendbox\Client;
$client = 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);
Uses Saved addreses.
<?php
// This file is generated by Composer
require_once __DIR__ . '/vendor/autoload.php';
use AbdulsalamIshaq\Sendbox\Client;
$client = new Client('{api_key}');
$client->shipment->addresses()
Uses Profile.
<?php
// This file is generated by Composer
require_once __DIR__ . '/vendor/autoload.php';
use AbdulsalamIshaq\Sendbox\Client;
$client = new Client('{api_key}');
$client->payment->profile()
Note: This package does not include the complete api endpoints because some endpoints return 404
composer test
Please see CHANGELOG for more information on what has changed recently.
Please review our security policy on how to report security vulnerabilities.
The MIT License (MIT). Please see License File for more information.