PHP code example of imper86 / php-inpost-api
1. Go to this page and download the library: Download imper86/php-inpost-api 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/ */
imper86 / php-inpost-api example snippets
use Imper86\PhpInpostApi\InpostApi;
use Imper86\PhpInpostApi\Plugin\AcceptLanguagePlugin;
// if you want to use all resources you must ask Inpost for
// access token via their contact form
// https://inpost.pl/formularz-wsparcie
$token = 'aaaa.aaaa';
// create api client
$api = new InpostApi($token);
// this library provides optional Plugin for localizing
// error messages
$api->addPlugin(new AcceptLanguagePlugin('pl_PL'));
// from now you can use these api methods:
$api->addressBooks()->(...);
$api->batches()->(...);
$api->dispatchOrders()->(...);
$api->dispatchPoints()->(...);
$api->mpks()->(...);
$api->organizations()->(...);
$api->points()->(...);
$api->sendingMethods()->(...);
$api->services()->(...);
$api->shipments()->(...);
$api->shipmentTemplates()->(...);
$api->statuses()->(...);
$api->tracking()->(...);
// fast example:
var_dump($api->organizations()->shipments()->get('1234'));