PHP code example of lendable / dvla-vehicle-enquiry-api-client
1. Go to this page and download the library: Download lendable/dvla-vehicle-enquiry-api-client 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/ */
lendable / dvla-vehicle-enquiry-api-client example snippets
declare(strict_types=1);
use Lendable\Dvla\VehicleEnquiry\Auth\ApiKeyAuthHttpClientDecorator;
use Lendable\Dvla\VehicleEnquiry\Auth\ValueObject\ApiKey;
use Lendable\Dvla\VehicleEnquiry\Client;
use Lendable\Dvla\VehicleEnquiry\Psr18ClientDecorator;
use Lendable\Dvla\VehicleEnquiry\Scope\VehiclesScope\Request\EnquiryRequest;
use Lendable\Dvla\VehicleEnquiry\Scope\VehiclesScope\ValueObject\RegistrationNumber;
use Nyholm\Psr7\Uri;
$client = new Client(
new ApiKeyAuthHttpClientDecorator(
new Psr18ClientDecorator(
new YourPsr18HttpClient()
),
ApiKey::fromString('YOUR-AUTHENTICATION-TOKEN')
),
new Uri('https://uat.driver-vehicle-licensing.api.gov.uk/vehicle-enquiry/v1')
);
$vehicleDetails = $client->vehicles()->enquireDetails(
EnquiryRequest::with(RegistrationNumber::fromString('AA19PPP'))
);