1. Go to this page and download the library: Download detrack/detrack-core 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/ */
use Detrack\DetrackCore\Resource\Job;
$delivery = new Job([
"date"=>"2018-12-19",
"do_number"=>"DO# 12345",
"address"=>"Null Island",
"instructions"=>"Tell recipient to come out and retrieve ice cream from van" //not
use Detrack\DetrackCore\Resource\Job;
$delivery = new Job();
$delivery->date = "2018-12-19";
$delivery->do_number = "DO# 12345";
$delivery->address = "Null Island";
$delivery->instructions = "Tell recipient to come out and retrieve ice cream from van"; //not
use Detrack\DetrackCore\Resource\Model\Item;
$item = new Item([
"sku"=>"IC 456",
"qty"=>"5",
"desc"=>"Strawberry flavoured ice-cream"
]);
use Detrack\DetrackCore\Model\Item;
$item = new Item();
$item->sku = "IC 456";
$item->qty = "5";
$item->desc = "Strawberry flavoured ice-cream";
$delivery->items->add($item);
$delivery->save() //sends the info to Detrack
// Update instructions
$delivery->instructions = "Change of plan, leave ice cream package in the mailbox instead";
$delivery->save();
// Customer no longer wants ice cream
$delivery->delete();
use Detrack\DetrackCore\Resource\Vehicle;
$vehicle = new Vehicle();
$vehicle->detrack_id = "SGVsbG8gV29ybGQ";
$vehicle->name = "Tom's Van";
$vehicle->save();
//or
$vehicle->create();
$tomsVehicle = new Vehicle();
$tomsVehicle->name = "Tom's Van";
$tomsVehicle = $tomsVehicle->hydrate(); //optional, assignTo will do it for you anyway
$delivery->assignTo($tomsVehicle);