PHP code example of trackmage / trackmage-sdk-php
1. Go to this page and download the library: Download trackmage/trackmage-sdk-php 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/ */
trackmage / trackmage-sdk-php example snippets
composer
$workspaceId = 100;
$response = $client->post('/shipments', ['json' => [
'workspace' => '/workspaces/'.$workspaceId,
'trackingNumber' => 'TN-1',
]]);
$shipment = TrackMageClient::item($response);
$response = $client->get('/workspaces/'.self::$workspaceId.'/shipments');
$shipments = TrackMageClient::collection($response);
$response = $client->get('/workspaces/'.$workspaceId.'/shipments');
$workspaces = TrackMageClient::collection($response);
$response = $client->get('/public/carriers');
$carriers = TrackMageClient::collection($response);
$workflow = [
'type' => 'webhook',
'period' => 'immediately',
'title' => 'Webhook for testing',
'workspace' => '/workspaces/<id>',
'enabled' => true,
'concurrency' => '1',
'url' => 'http://acme.example',
'authType' => 'basic',
'username' => 'webhook_user',
'password' => 'password',
'notificationEmails' => [
'[email protected] ', '[email protected] ',
],
];
$response = $client->post('/workflows', ['json' => $workflow]);
$workflow = TrackMageClient::item($response);
$workflowId = $workflow['id'];