dev-master
9999999-devSDK for Shyplite shipment service
MIT
The Requires
by Md Adil
marketplace shipment shyplite shyplite api
Wallogit.com
2017 © Pedro Peláez
SDK for Shyplite shipment service
Composer is the best friend to install any php libraries / dependancies with their dependancies. If you haven't already installed then follow the link Composer, (*1)
Then run following command in your terminal/command prompt where your application is installed., (*2)
composer require md-adil/shyplite dev-master
Before making any request you need to set token first., (*3)
Getting token, (*4)
use Adil\Shyplite\Shyplite;
$congis = [
'username'=> '<email-id>',
'password' => '<password>',
'app_id' => '<app-id>', // Your app's ID
'seller_id' => '<seller-id>', // Your seller ID
'key' => '<key>'
];
$shyplite = new Shyplite($configs); // Constructor takes config array as argument
$response = $shyplite->login();
$shyplite->setToken($response->userToken);
To create order, (*5)
$orders = $shyplite->order()->add([/*order array provided in official doc*/])
->add([/*Add more order not more than 25*/])
->create() // finally create order and return array of Order model which hold the values you provided with response id and success status
// or
foreach($orders as $order) {
echo $order->id; // response success id
echo $order->getError(); // if error on particular order
echo $order->hasError(); // true or false
}
To cancel order, (*6)
$shyplite->order()->cancel([/* array of order id */])
Getting slip, (*7)
$slip = $shyplite->shipment()->getSlip(/* order id */); echo $slip->name; // name of slip echo $slip->download(/* download location */);
Getting manifest, (*8)
$menifest = $shyplite->shipment()->menifest(/* menifest id provided by getSlip function */); echo $menifest->name; // name of menifest echo $menifest->path // path to download menifest $menifest->download(/*path to download*/);
To check service availability., (*9)
$available = $shyplite->service()->availability($sourcePincode, $destinationPincode); print_r($avaialable);
Required:, (*10)
$config = [
'username'=> '<email-id>',
'password' => '<password>',
'app_id' => '<app-id>', // Your app's ID
'seller_id' => '<seller-id>', // Your seller ID
'key' => '<key>'
];
Default:, (*11)
protected $configs = [
'verified_request' => false,
'base_uri' => 'https://api.shyplite.com',
'order_uri' => 'order',
'get_slip_uri' => 'getSlip',
'availablity_uri' => 'getserviceability',
'track_uri' => 'track',
'manifest_uri' => 'getManifestPDF',
'ordercancel_uri' => 'ordercancel'
];
You can override default configs by providing the key your own config like:, (*12)
$configs = [
/* our configs */,
'verified_request' => true, // Now you need to add certificate to make verified reques.
'order_uri' => 'orders', // If later on shyplite decide to change their uri.
]
Let the laravel know about your plugin., (*13)
configs/app.php, (*14)
return [
// providers section.
'providers' => [
// ...,
Adil\Shyplite\Laravel\ShypliteServiceProvider::class
],
'aliases' => [
// ...
'Shyplite' => Adil\Shyplite\Laravel\Facade\Shyplite::class
]
];
// use it in your app
Shyplite::setToken($yourtoken);
Shyplite::order()->add()->create();
Now add shyplite specific settings in your configs directory., (*15)
configs/shyplite.php, (*16)
return [
'username'=> '<email-id>',
'password' => '<password>',
'app_id' => '<app-id>', // Your app's ID
'seller_id' => '<seller-id>', // Your seller ID
'key' => '<key>'
];
This is unofficial shyplite sdk for php / laravel., (*17)
I appreciate your feedback. If you find any issues please don't forget to letme know either mail me or create github issue. if you like my efforts please dont forget to give star., (*18)
SDK for Shyplite shipment service
MIT
marketplace shipment shyplite shyplite api