1. Go to this page and download the library: Download alwayscurious/laravel-vin 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/ */
alwayscurious / laravel-vin example snippets
use AlwaysCurious\Vin\Facades\Vin;
// Throws VinLookupException on an invalid VIN, an API failure, or when
// live decoding is disabled by configuration.
$vehicle = Vin::lookup('7YAMYFS50TY009706');
// Optional model-year hint to improve decoding accuracy:
$vehicle = Vin::lookup('7YAMYFS50TY009706', 2026);
use AlwaysCurious\Vin\VinLookupService;
public function __construct(private readonly VinLookupService $vin) {}
// ...
$vehicle = $this->vin->lookup('7YAMYFS50TY009706');
namespace App\Vin;
use AlwaysCurious\Vin\Contracts\VinDecoder;
use AlwaysCurious\Vin\VehicleData;
use AlwaysCurious\Vin\VinLookupException;
use Illuminate\Support\Facades\Http;
class AcmeVinDecoder implements VinDecoder
{
public function __construct(private readonly string $apiKey) {}
public function decode(string $vin, ?int $modelYear = null): VehicleData
{
$response = Http::withToken($this->apiKey)
->acceptJson()
->get("https://vin.acme.test/decode/{$vin}");
if ($response->failed()) {
throw VinLookupException::requestFailed($vin, $response->status());
}
// Map the provider's shape onto VehicleData however it returns data.
return new VehicleData(
vin: $vin,
year: $response->json('year'),
make: $response->json('make'),
model: $response->json('model'),
series: $response->json('series'),
trim: $response->json('trim'),
bodyClass: $response->json('body_class'),
errorCode: 0,
errorText: null,
);
}
}
use AlwaysCurious\Vin\Facades\Vin;
use App\Vin\AcmeVinDecoder;
Vin::extend('acme', fn ($app) => new AcmeVinDecoder($app['config']['services.acme.key']));