PHP code example of shimango / gophr

1. Go to this page and download the library: Download shimango/gophr 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/ */

    

shimango / gophr example snippets


  @param string   $apiKey - The API key obtained from Gophr
  @param bool     $isSandbox (Default false) - If true the Gophr sandbox environment will be used
  @param string   $apiVersion (Default "v2") - The API version to be used. Currently, only v2 is supported
  @param int|null $proxyPort (Default null) - If the calls are sent via proxy the port number can be set here 
  @param bool     $proxyVerifySSL (Default false) - Sets verify proxy SSL to true if using a proxy is being used

use Shimango\Gophr\Client;
use Shimango\Gophr\Common\Configuration;

$config = new Configuration('YOUR_API_KEY');
$gophr = new Client($config);

$response = $gophr->listJobs();
var_dump($response->getContentsArray());

use Shimango\Gophr\Client;
use Shimango\Gophr\Common\Configuration;

$isSandbox = true;

$config = new Configuration('YOUR_API_KEY', $isSandbox);
$gophr = new Client($config);

$page = 2; // The page number to be returned
$count = 15; // The number of jobs returned per page
$

// Creates a job with a single pickup point and multiple drop off locations.
createJob(array $jobData)

// Get the details of a job with the given job id.
getJob(string $jobId)

// Allows a job to be updated to confirmed.
updateJob(string $jobId, array $jobData)

// Cancels a job
CancelJob(string $jobId, array $jobData)

// Get all jobs associated with the API key used.
listJobs(int $page = 1 ,int $count = 15, bool $

// Creates a delivery for an existing job. The delivery consists of a pickup, dropoff and collection of parcels.
// Note that adding deliveries to a job is not allowed once the job has been confirmed.
createDelivery(string $jobId, array $deliveryData)

// Get the details of a delivery.
getDelivery(string $jobId, string $deliveryId)

// Updates a delivery. Parcels may also be added / edited via this method.
// Note that updating deliveries is not allowed once the job has been confirmed.
updateDelivery(string $jobId, string $deliveryId, array $deliveryData)

// Get a list of deliveries for a given job.
listDeliveries(string $jobId)

// Cancels a delivery. Note that cancelling deliveries is not allowed once the job has been confirmed.
cancelDelivery(string $jobId, string $deliveryId, array $deliveryData)

// Progresses a delivery status. This functionality is not available in production.
progressDeliveryStatus(string $jobId, string $deliveryId)

// Creates a parcel for the given delivery.
// Note that adding parcels to a delivery is not allowed once the job has been confirmed.
createParcel(string $jobId, string $deliveryId, array $parcelData)

// Get the details of a given parcel.
getParcel(string $jobId, string $deliveryId, string $parcelId)

// Updates a parcel. Note that updating parcels is not allowed once the job has been confirmed.
// Note that updating parcels is not allowed once the job has been confirmed.
updateParcel(string $jobId, string $deliveryId, string $parcelId, array $deliveryData)

// Removes a parcel from a delivery. If the parcel count is 0 after deletion then the delivery will be cancelled.
// Note that deleting parcels is not allowed once the job has been confirmed.
deleteParcel(string $jobId, string $deliveryId, string $parcelId)

// Returns a collection of parcels for the given delivery.
listParcels(string $jobId, string $deliveryId)
 
getContentsArray() // Returns the response body as an array
getContentsObject() // Returns the response body as an object 
shell