PHP code example of ampahkwabena / ghanapostgps

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

    

ampahkwabena / ghanapostgps example snippets


composer 


$asaaseUser = 'ASAASE-USER-ID'
$deviceId = 'DEVICE-ID'
$aesKey = 'AES-KEY-FOR-DEVICE'

$gps = new GhanaPostGPS\GhanaPostGPS($asaaseUser, $deviceId, $aesKey);


// Ghana Code
$gpsName = 'GA-585-7449';
 
// Location contains center latitude and longitude as well as
// a box around the center. You also get postcode, region,
// area, street, etc.
$location = $gps->getLocation($gpsName);



$location = [
    'lat' => 5.7525573723,
    'lng' => -2.873287368
];

// The GPS info contains postcode, region, area and street info
// for the provided location.
$gpsInfo = $gps->getGps($location);