Download the PHP package shusaura85/fancourier-api without Composer
On this page you can find all versions of the php package shusaura85/fancourier-api. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download shusaura85/fancourier-api
More information about shusaura85/fancourier-api
Files in shusaura85/fancourier-api
Package fancourier-api
Short Description Library for FanCourier API v2.0
License MIT
Informations about the package fancourier-api
FANCourier API v2.0
Table of contents
- Information
- Installation
- Requirements
- Composer
- Usage
- Authentication
- Get estimated shipping cost
- Create AWB
- Create AWB in bulk
- Track AWB
- Track awb in bulk
- FANBox
- Print AWB (PDF)
- Print AWB (ZPL)
- Print AWB Html
- Delete AWB
- License
Information
This version of the library is designed for FANCourier API v2.0 (JSON based responses). The code works and there are examples for all API requests, however, the documentation is not yet ready.
All requests have the method getData()
that returns the unprocessed response of the API. Aditional functions depend on the response object type to return processed data.
Installation
Requirements
- PHP >= 7.0
NOTE At the moment it's designed to work with PHP 7.0 and newer.
However, the plan is to add type and return type declarations for all functions that will push the requirements to PHP 8.1 at the minimum
Composer
Require the package via composer
Manual
If used without composer, you will need to manually require the autoload.php
file
Usage
At the moment complete and proper documentation is not yet available. However, there are examples for every request type you can make.
Inside them you will also find comments with complete function list for each request
, response
and object
.
Authentication
Create a new instance of Fancourier.php
supplying the client_id
, username
, password
and token
.
Or you can use the test instance static method:
The generated token has a life time of 24 hours and must be refreshed after this period. You can get the generated token using the function:
If the specified token is empty when creating the instance, it will be generated automatically on the first request.
Get estimated shipping cost
Request
Response
Create AWB
Request
Response
Create AWB in bulk
Unlike the previous version, there is no longer a CreateAwbBulk request. Simply create as many AWBIntern objects and add them to the request
Request
Response
Track AWB
Request
Response
Track awb in bulk
Unlike previous version, you can use the same TrackAwb() object and add as many AWB's as you need to Track
Request
Response
FANBox
You can now easily get information about available FANBox and PayPoint locations. FAN Courier calls there PUDO (Pick Up Drop Off).
When creating an AWB for them, set the address to the PUDO address as received here as well as calling the function setPickupLocation(PUDO_ID)
with the ID of the selected PUDO.
Request
Response
Print AWB
The print request can print one or more AWBs using a single request.
You can specify the size of the AWB using the ->setSize()
function. Available options are: empty, A4, A5 and A6. A6 can only be used with ePod option.
PDF printing is the default mode of printing.
Please note that you can't request ZPL and PDF at the same time. Using setPdf()
will automatically disable ZPL option if set.
Request
Response
Print AWB ZPL
You can request the AWB in the ZPL format (Zebra Programming Language) for use with a label printer.
Please note that you can't request ZPL and PDF at the same time. Using setZpl()
will automatically disable PDF option if set.
Request
Response
Print AWB Html
If you want the AWB in a HTML format, just use ->setPdf(false) to get HTML data instead of PDF.
Request
Response
Delete AWB
Request
Response
License
Fancourier Api is open-source software licensed under the MIT license.
All versions of fancourier-api with dependencies
ext-curl Version *
ext-json Version *