Download the PHP package develart-projects/olza-logisctic-api-client without Composer
On this page you can find all versions of the php package develart-projects/olza-logisctic-api-client. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download develart-projects/olza-logisctic-api-client
More information about develart-projects/olza-logisctic-api-client
Files in develart-projects/olza-logisctic-api-client
Package olza-logisctic-api-client
Short Description Client for Olza Logistic system API
License MIT
Informations about the package olza-logisctic-api-client
OlzaLogistic API PHP Client
Olza Logistic PHP API client is a useful PHP helper for developers who want to integrate basic API actions into their e-shop/application. It covers most of the needed possibilities, but programmers are free to use the API directly, if they need a special functionality that is not provided by the client.
For additional information please contact your dedicated Olza Logistic manager.
Important notices
It's recommended to lock client minor version in composer to avoid unintended client interface changes, which can occur in between the minor versions.
!! Breaking change from version 1.6.0 !! From version 1.6.0 http client is decoupled and Guzzle is not provided by default. You have to either install it by yourself or you are free to use any PSR-18 client instead. Instantination of the client has also changed.
Features
- client provides standard interface for preparing requests, including entities for each API call
- client automatically checks and validates returned results
- results are hydrated into prepared lists and entities for easier manipulation
- different types of exceptions are thrown/returned, based on the occurred event
- included support for Composer
Structure of client
The client is documented using DocBlock, so feel free to read the description of functions/classes provided. You can find following types of files within the client’s structure:
- examples - every API call has its own client usage example in this folder, please start here.
- src/entities/helpers - data structures to prepare request data. Fill structure using setters/methods to prepare request.
- src/entities/request - request helper. Feed these classes with helper objects (or use direct array feed) to get correct API request structure.
- src/entities/response - classes, which hold returned results. Client sorts all response types into provided classes. Whole response is accessible by ApiBatchResponse object
- exception - all exception types by API event. Read class description to get meaning of an exception.
Basic usage example (using Guzzle client)
More verbose usage examples are located in the examples folder. Contact your dedicated Olza Logistic manager to gain access to API and URLs.
The client has only one mandatory constructor parameter: Transport object. This object covers all needs for HTTP communication and it's part or the package. By setting up Transport object, you are telling to client how to communicate. In this example Guzzle client has to be installed before client is used.
Example of getting shipments statuses:
Advanced usage example (using any PSR-18 client)
This is really handy, when Guzzle can't be used, because of version clashes, or if you preffer any other http client. Http client has to follow PSR-18 interface and you will need PSR-17 factories as well. Implementation details are your choice.
Example of setting up client using PSR-18 http client. This example is using Symfony PSR-18 http client (symfony/http-client) and Http Soft PSR-17 factories (httpsoft/http-message).
You can combine all 3 additional params of the Transport object as you wish.
Installing the client
The recommended way to install Olza Logistic API client is through Composer.
Next, run the Composer command to install the latest stable version of Client:
After installing, you need to require Composer's autoloader:
You can then later update Client using composer:
All versions of olza-logisctic-api-client with dependencies
psr/http-factory Version ^1.0
php Version >=7.1
ext-json Version *