daurensky / winfreight-php-sdk
PHP SDK for Winfreight API
1.0.4
2022-11-07 09:53 UTC
Requires
- php: ^7.1|^8.0
- ext-json: *
- guzzlehttp/guzzle: ~5.0
README
The Winfreight SDK for PHP makes it easy for developers to access Winfreight API in their PHP code. You can get started in minutes by installing the SDK through Composer or by downloading a single zip or phar file from our latest release.
Jump to:
Getting started
- Get your username and password of Winfreight API.
- Minimum requirements - To run the SDK, your system will need to have PHP >= 7.1.
composer require daurensky/winfreight-php-sdk
- Check the Quiz Examples
Quick Examples
Authorize client
<?php
require_once __DIR__ . '/vendor/autoload.php';
use Daurensky\WinfreightPhpSdk\Winfreight;
$username = {username};
$password = {password};
// Prev token data
$accessToken = {prev access token};
$expiresIn = {prev expires in};
$winfreight = new Winfreight($username, $password);
$winfreight->setToken($accessToken, $expiresIn);
if ($winfreight->rottenToken()) {
$authorization = $winfreight->renewToken();
/*
* Your token refresh. Ex:
* DB::insert('credentials', [
* 'access_token' => $authorization->getAccessToken();
* 'expires_in' => $authorization->getExpiresIn();
* ]);
*/
}
Get data from API
<?php
$hubCodes = $winfreight->getHubCodes([
'GroupName' => 'Wintest',
'Province' => 'Western Cape',
'Suburb' => 'Constantiavale',
]);
$servCodee = $winfreight->getServCode([
'GroupName' => 'Wintest',
]);
$portalWaybill = $winfreight->createPortalWaybill([
'Waybill' => 'TEST005',
'Date' => '2021/01/13',
'SenderCustomerID' => 13,
...
]);
To do
- Create Collection
- Create Waybill
- Create Parcel
- Create Collection Dimensions
- Get Tracking
- Get Hub Codes
- Get Serv Code
- Get Waybill
- Get POD information for multiple waybills
- Get Quote information
- Create Waybill Import Header
- Create Waybill Import Dims and Details
- Delete Waybill
- Delete Collection
- Create Ewaybill Prestored
- Create Prestored Dimensions
- Create POD
- Create Track
- Create POD Image
- Create Portal Waybill
- Get Label Data
- Check Waybill