PHP package for GhanaPostGPS
This package connects with the GhanaPostGPS to look for digital addresses in Ghana.
You can install the package via composer using
composer require omnilesolutions/ghanapostgps
Before connecting to GhanaPostGPS, you'll need the following:
- AsaaseUser ID This is given to you during on-boarding with the GhanaPostGPS team and can be found under your profile from the GPSAdmin Portal
- DeviceID You'll need to create a device on the GPSAdmin Portal and use the ID. Note that you can create multiple devices on the portal.
- AES Key The GhanaPostGPS server uses AES encryption to communicate with with clients. You can access your AES key for each device you create in the portal.
Use the GhanaPostGPS\GhanaPostGPS
object to get data.
$asaaseUser = 'YOUR-ASAASE-USER-ID'
$deviceId = 'YOUR-DEVICE-ID'
$aesKey = 'YOUR-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);
Tests are setup in a way that actually connect with GhanaPostGPS to make sure everything works.
To run tests, supply your credentials in tests/Unit/GhanaPostGPSTest
and run vendor/bin/phpunit
Contributions are welcome! Please do a PR with any bug-fixes or email me at brightantwiboasiako@aol.com for a long term commitment.
This open-source project is licensed under the MIT LICENSE