mijnpartnergroep-nl / sidn-suggestion-api-php
SIDN Suggestion API client library for PHP. SIDN is the registrar for .nl fqdn's.
Package info
github.com/MijnPartnerGroep-nl/sidn-suggestion-api-php
pkg:composer/mijnpartnergroep-nl/sidn-suggestion-api-php
Requires
- php: >=7.4
- ext-curl: *
- ext-json: *
- ext-openssl: *
- composer/ca-bundle: ^1.1
- guzzlehttp/guzzle: ^6.3 || ^7.0
Requires (Dev)
None
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
PHP client for SIDN suggestion API
Requirements and Authorization
To use the API you must request access by sending a request to support@sidn.nl or contacting your SIDN representative. When approved you will be provided with access to the API. The API uses the Client Authorization flow for server-side authorization. To start the authorization flow, you need to request a clientId and clientSecret. You can request these from SIDN Support.
Installation
The easiest way to install this client is to require it using Composer.
Install using composer require MijnPartnerGroep-nl/sidn-suggestion-api-php:^0.1
Or add to your composer.json:
{
"require": {
"MijnPartnerGroep-nl/sidn-suggestion-api-php": "^0.1"
}
}
Example usage
Example usage as found in the examples folder.
<?php include("vendor\autoload.php"); use \Sidn\Suggestion\Api\Exceptions\ApiException; use \Sidn\Suggestion\Api\SidnSuggestionApiClient; try { // Create new instance of SidnSuggestionApiClient $sidnApi = new SidnSuggestionApiClient(); // Authenticate using Client Id and Client Secret provided by SIDN $auth = $sidnApi->authenticate->authenticate($client_id, $client_secret); $sidnApi->setAccessToken($auth->access_token); // Search for domain suggestions $suggestions = $sidnApi->suggestion->search("bike.nl", 1000); print_r($suggestions->suggestions); // Optionally, query the used configuration from the results print_r($suggestions->config); // Optionally, query the used domain (cleaned) from the results print_r($suggestions->original); } catch (ApiException $ae) { echo "Error occured at: ".$ae->getTimestamp() . ";<br />Message: ".$ae->getMessage(); throw $ae; }