A simple Object Oriented PHP Client for Sendbox API

v1.0.1 2022-05-15 00:57 UTC

This package is auto-updated.

Last update: 2024-04-15 04:57:35 UTC


README

A simple Object Oriented PHP Client for Sendbox SMS API.

Uses Sendbox API.

Requirements

  • PHP ^8.0
  • Guzzlehttp ^7.0

Installation

Via Composer.

PHP ^8.0:

composer require abdulsalamishaq/sendbox

Basic usage

<?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();

Shipment

Get Shipments

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();

Get Shipment

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}');

Request Shipping quotes

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);

Create New Shipment

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);

Saved addresses

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()

Payment

Payment Profile

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

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.