PHP Quickstart Guide
Get started with CarsXE's PHP SDK to integrate comprehensive vehicle data into your PHP applications.
The CarsXE PHP SDK provides a simple and powerful way to integrate vehicle data into your PHP applications. This guide will help you get started quickly.
For more information, see the package on Packagist.
Installation
Install the CarsXE PHP package using Composer:
composer require carsxe/carsxe
Setup
First, require the autoloader and initialize the CarsXE client:
app.php
<?php
require_once __DIR__ . '/vendor/autoload.php';
use CarsxeDeveloper\Carsxe\Carsxe;
// Initialize the client
$API_KEY = 'YOUR_API_KEY_HERE';
$carsxe = new Carsxe($API_KEY);Basic Usage
VIN Specifications
app.php
<?php
$vin = 'WBAFR7C57CC811956';
try {
$vehicle = $carsxe->specs(['vin' => $vin]);
echo $vehicle['input']['vin'];
} catch (Exception $error) {
echo "Error: " . $error->getMessage();
}International VIN Decoder
app.php
<?php
try {
$intvin = $carsxe->intVinDecoder([
'vin' => 'WF0MXXGBWM8R43240'
]);
echo json_encode($intvin, JSON_PRETTY_PRINT);
} catch (Exception $error) {
echo "Error: " . $error->getMessage();
}Market Value
app.php
<?php
try {
$marketvalue = $carsxe->marketValue([
'vin' => 'WBAFR7C57CC811956'
]);
echo json_encode($marketvalue, JSON_PRETTY_PRINT);
} catch (Exception $error) {
echo "Error: " . $error->getMessage();
}Vehicle History
app.php
<?php
try {
$history = $carsxe->history([
'vin' => 'WBAFR7C57CC811956'
]);
echo json_encode($history, JSON_PRETTY_PRINT);
} catch (Exception $error) {
echo "Error: " . $error->getMessage();
}License Plate Decoder
app.php
<?php
try {
$decoded_plate = $carsxe->plateDecoder([
'plate' => '7XER187',
'state' => 'CA',
'country' => 'US'
]);
echo json_encode($decoded_plate, JSON_PRETTY_PRINT);
} catch (Exception $error) {
echo "Error: " . $error->getMessage();
}Vehicle Images
app.php
<?php
try {
$images = $carsxe->images([
'make' => 'BMW',
'model' => 'X5',
'year' => '2019'
]);
echo json_encode($images, JSON_PRETTY_PRINT);
} catch (Exception $error) {
echo "Error: " . $error->getMessage();
}Vehicle Recalls
app.php
<?php
try {
$recalls = $carsxe->recalls([
'vin' => '1C4JJXR64PW696340'
]);
echo json_encode($recalls, JSON_PRETTY_PRINT);
} catch (Exception $error) {
echo "Error: " . $error->getMessage();
}Plate Image Recognition
app.php
<?php
try {
$plateimg = $carsxe->plateImageRecognition([
'upload_url' => 'https://api.carsxe.com/img/apis/plate_recognition.JPG'
]);
echo json_encode($plateimg, JSON_PRETTY_PRINT);
} catch (Exception $error) {
echo "Error: " . $error->getMessage();
}VIN OCR from Image
app.php
<?php
try {
$vinocr = $carsxe->vinOcr([
'upload_url' => 'https://api.carsxe.com/img/apis/plate_recognition.JPG'
]);
echo json_encode($vinocr, JSON_PRETTY_PRINT);
} catch (Exception $error) {
echo "Error: " . $error->getMessage();
}Year-Make-Model Search
app.php
<?php
try {
$yymm = $carsxe->yearMakeModel([
'year' => '2012',
'make' => 'BMW',
'model' => '5 Series'
]);
echo json_encode($yymm, JSON_PRETTY_PRINT);
} catch (Exception $error) {
echo "Error: " . $error->getMessage();
}OBD Code Decoder
app.php
<?php
try {
$obdcode = $carsxe->obdCodesDecoder([
'code' => 'P0115'
]);
echo json_encode($obdcode, JSON_PRETTY_PRINT);
} catch (Exception $error) {
echo "Error: " . $error->getMessage();
}Lien and Theft
app.php
<?php
try {
$lienAndTheft = $carsxe->lienAndTheft([
'vin' => '2C3CDXFG1FH762860'
]);
echo json_encode($lienAndTheft, JSON_PRETTY_PRINT);
} catch (Exception $error) {
echo "Error: " . $error->getMessage();
}Start building powerful automotive applications with CarsXE's PHP SDK!