Skip to content

piwni/laravel-shippypro-client

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 

Repository files navigation

Shippypro Connector

Shippypro connector is a simple PHP library that allows to integrate Shippypro into your project. You can check carrier rates and ship orders.

Add folowing line to config/app.php to providers array

'providers' => [
    ...
    \yax\ShippyProConnector\ShippyproServiceProvider::class
],

Then you have to publish configuration. Execute command

    php artisan vendor:publish

After that you have to configure your Shippypro API key in config/shippypro.php

    /* This example uses env file but you can paste in this place your API key */
    'api_key' => env('SHIPPYPRO_API', null),

This is an example integration

$sender = new ShippyproAddress('Jan Kowalski', '/', 'Prosta 20', '/', 'Wrocław', 'DS', '50-419', 'PL', '445544544', '[email protected]');
$recivier = new ShippyproAddress('Jan Kowalski', '/', 'Prosta 20', '/', 'Wrocław', 'DS', '50-419', 'PL', '445544544', '[email protected]');
$parcel = new ShippyproParcel('30', '20', '20', '10');
$shipment = new ShippyproShipment(30.00, 'Description');
$shipment->to_address($recivier);
$shipment->from_address($sender);
$shipment->addParcel($parcel);
$array = $shipment->getRates();
$rate = $array->searchByKey('carrier_id', 1081);
$shipment->setTransactionId(2349);
if ($rate) {
    $shipment->setRate($rate);
    $order = $shipment->purchase();
}

About

A Laravel package integrating ShippyPro API

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages