This SDK provides simple access to the ABN Lookup service. It currently handles the following requests
- List SOAP functions
- Search for an ABN
Install the SDK into your project using Composer.
You'll need to register with the ABR to get a GUID - http://abr.business.gov.au/RegisterAgreement.aspx
composer require heshanh/abn
This package ships with a Laravel specific service provider which allows you to set your credentials from your configuration file and environment.
Add the following to the providers
array in your config/app.php
file.
heshanh\Abn\LaravelServiceProvider::class
In your config/services.php
file, add the following to the array.
'abn' => [
'service_url' => env('ABN_SERVICE_URL'),
'guid' => env('ABN_GUID')
]
In your .env
file, add the following keys.
ABN_SERVICE_URL=
ABN_GUID=
To resolve a client, you simply pull it from the service container. This can be done in a few ways.
use heshanh\Abn;
public function yourControllerMethod(SoapClient $client) {
// Call methods on $client
}
use heshanh\Abn;
public function anyMethod() {
$client = app(SoapClient::class);
// Call methods on $client
}
$client->getFunctions()
$client->search($abn, $params)
try {
$client = app(SoapClient::class);
$response = $client->search(51824753556, ['includeHistoricalDetails' => 'N']);
if (isset($response->ABRPayloadSearchResults->response->exception)) {
$response = json_encode($response->ABRPayloadSearchResults->response->exception);
}
} catch (\Exception $e) {
//Error!
}
Coming soon