PHP code example of eduardlleshi / ch-robinson-laravel
1. Go to this page and download the library: Download eduardlleshi/ch-robinson-laravel 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/ */
eduardlleshi / ch-robinson-laravel example snippets
use CHRobinson\Core\CHRobinsonHttpClient;
use CHRobinson\Core\SandboxEnvironment;
$client = new CHRobinsonHttpClient(new SandboxEnvironment(
getenv('SANDBOX_CLIENT_ID'),
getenv('SANDBOX_CLIENT_SECRET')
));
use CHRobinson\Shipments\MilestoneUpdates;
$request = new MilestoneUpdates;
$request->body = [
'eventCode' => 'X6',
'shipmentIdentifier' => [
'shipmentNumber' => '123456789'
],
'dateTime' => [
'eventDateTime' => '2019-12-16T18:36:13.131Z'
],
'location' => [
'address' => [
'address1' => 'address if known, or blank',
'city' => 'state if known, or blank',
'stateProvinceCode' => 'state if known, or blank',
'country' => 'US',
'latitude' => '31.717096',
'longitude' => '-99.132553'
]
]
];
$response = $client->execute($request);
if ($response->getStatusCode() == 201) {
echo 'Success';
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.