PHP code example of firewizard / innoship-sdk

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

    

firewizard / innoship-sdk example snippets


$innoship = new Innoship\Innoship('my-api-key-123');

$locations = $innoship->location()->clientLocations()->getContent();

$countries = $innoship->location()->countries()->getContent();

$cities = $innoship->location()->cities('94')->getContent();

$innoship->location()->regions('HU')->getContent());

$innoship->feedback()->get('2021-12-01', '2021-12-10')->getContent();

$info = $innoship->track()->byAwb('3', '5749162310001')->getContent();

$info = $innoship->track()->byAwb('3', ['5749162310001', '5749162310002'])->getContent();

file_put_contents('awb-5749162310001.pdf', $innoship->label()->byCourierAwb('3', '5749162310001')->getContent();

$request = new Innoship\Request\GetFixedLocations();
$request
    ->setCourier('Sameday')
    ->setCountryCode('RO')
    ->setCountyName('Bucuresti')
    ->setLocalityName('Bucuresti')
    ->setFixedLocationType($request::TYPE_LOCKER);

$locations = $innoship->location()->fixedLocations($request);

$address = new Innoship\Request\CreateOrder\Address();
$address
    ->setName('Tester Testerson')
    ->setContactPerson('Tester Testerson')
    ->setPhone('0723000000')
    ->setEmail('[email protected]')
    ->setAddressText('Sos Principala nr 1')
    ->setLocalityName('Socolari')
    ->setCountyName('Caras-Severin')
    ->setCountry('RO');

$content = new Innoship\Request\CreateOrder\Content();
$content
    ->setParcelsCount(1)
    ->setTotalWeight(10)
    ->setContents('Obiecte de artă')
    ->setPackage('carton');

$extra = new Innoship\Request\CreateOrder\Extra();
$extra
    //->setOpenPackage(true)
    //->setSaturdayDelivery(true)
    ->setBankRepaymentAmount(125)
    ->setBankRepaymentCurrency('RON');

$request = new Innoship\Request\CreateOrder();
$request
    ->setServiceId(1)
    ->setShipmentDate(now())
    ->setAddressTo($address)
    ->paidBySender()
    ->setContent($content)
    ->setExtra($extra)
    ->setExternalClientLocation('Default')
    ->setExternalOrderId('10000001')
    ->setSourceChannel('website')
    ->setCustomAttributes(['x' => 1, 'y' => 2])
    //->

$response = $innoship->order()->create($request);

$response = $innoship->order()->delete('3', '5749162310001');