Download the PHP package hrx/api-lib without Composer
On this page you can find all versions of the php package hrx/api-lib. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package api-lib
HRX-API library
Its a library for HRX WOP API.
Using HRX-API library
__PATH_TO_LIB__
is path to where HRX-API is placed. This will load HrxApi namespace
Validations, checks, etc. throws Exception and calls to library classes should be wrapped in: blocks
Any function starting with add
or set
returns its class so functions can be chained.
Authentication
Uses supplied user $token
. It is called during API object creation.
- Initialize new API library using:
$api = new API();
- Set API token using:
$api->setToken($token);
API additional commands
After initializing the API class, some parameters can be changed.
- Change timeout value:
$api->setTimeout(60);
- Enable debug data return:
$api->setDebug(true);
- Enable connection to the test endpoint (only works with a testing token):
$api->setTestMode(true);
- Change test endpoint:
$api->setTestUrl($url);
- Change live endpoint:
$api->setLiveUrl($url);
Simple example:
Getting locations (v1) - Deprecated
Getting locations (v2)
Finding nearest location
The library has an additional feature that allows to find the nearest location in the list of locations. There is also a possibility to sort the list from nearest.
Creating Receiver
use HrxApi\Receiver;
will allow creating Receiver object.
Minimum required setup:
When sending via courier:
Creating shipment
use HrxApi\Shipment;
will allow creating Shipment object.
Minimum required setup:
Creating order
use HrxApi\Order;
will allow creating Order object.
Minimum required setup:
Generating order
All process syntax when sent to the delivery location:
All process syntax when sent to the receiver address via courier:
Getting all orders from API
Getting single order data from API
Get order:
Get label (when the tracking number is successfully generated):
Get return label:
Get tracking events:
Getting public tracking information
- The tracking number is indicated in the order data received from the API, if the order was registered without errors
Set order ready state
Ready state denotes whether parcel is packed, labelled and ready for pickup.
Can be called while order has new
, ready
status.
Cancel order
Debug
If problems are encountered with API requests, debugging information can be obtained to determine the problem. First need to activate debug mode after the initialization of the API class and after executing some query, debugging information can be obtained.
Examples
Check src/examples/ for this API library examples. The file index.php shows all the functions.
All versions of api-lib with dependencies
ext-json Version *