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 <a href="https://packagist.org/packages/carsxe/carsxe" target="\_blank" style={{textDecoration: 'underline'}}>package on Packagist</a>.

## Installation

Install the CarsXE PHP package using Composer:

`composer require carsxe/carsxe`

## Setup

First, require the autoloader and initialize the CarsXE client:

<CodeGroup title="app.php">
```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);
```
</CodeGroup>

## Basic Usage

### VIN Specifications

<CodeGroup title="app.php">
```php
<?php
$vin = 'WBAFR7C57CC811956';
try {
    $vehicle = $carsxe->specs(['vin' => $vin]);
    echo $vehicle['input']['vin'];
} catch (Exception $error) {
    echo "Error: " . $error->getMessage();
}
```
</CodeGroup>

### International VIN Decoder

<CodeGroup title="app.php">
```php
<?php
try {
    $intvin = $carsxe->intVinDecoder([
        'vin' => 'WF0MXXGBWM8R43240'
    ]);
    echo json_encode($intvin, JSON_PRETTY_PRINT);
} catch (Exception $error) {
    echo "Error: " . $error->getMessage();
}
```
</CodeGroup>

### Market Value

<CodeGroup title="app.php">
```php
<?php
try {
    $marketvalue = $carsxe->marketValue([
        'vin' => 'WBAFR7C57CC811956'
    ]);
    echo json_encode($marketvalue, JSON_PRETTY_PRINT);
} catch (Exception $error) {
    echo "Error: " . $error->getMessage();
}
```
</CodeGroup>

### Vehicle History

<CodeGroup title="app.php">
```php
<?php
try {
    $history = $carsxe->history([
        'vin' => 'WBAFR7C57CC811956'
    ]);
    echo json_encode($history, JSON_PRETTY_PRINT);
} catch (Exception $error) {
    echo "Error: " . $error->getMessage();
}
```
</CodeGroup>

### License Plate Decoder

<CodeGroup title="app.php">
```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();
}
```
</CodeGroup>

### Vehicle Images

<CodeGroup title="app.php">
```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();
}
```
</CodeGroup>

### Vehicle Recalls

<CodeGroup title="app.php">
```php
<?php
try {
    $recalls = $carsxe->recalls([
        'vin' => '1C4JJXR64PW696340'
    ]);
    echo json_encode($recalls, JSON_PRETTY_PRINT);
} catch (Exception $error) {
    echo "Error: " . $error->getMessage();
}
```
</CodeGroup>

### Plate Image Recognition

<CodeGroup title="app.php">
```php
<?php
try {
    $plateimg = $carsxe->plateImageRecognition([
        'upload_url' => 'https://imagedelivery.net/moyiiSImjJPI_EZVxNMBBw/f49aed53-d736-4370-f3f4-97418841c800/public'
    ]);
    echo json_encode($plateimg, JSON_PRETTY_PRINT);
} catch (Exception $error) {
    echo "Error: " . $error->getMessage();
}
```
</CodeGroup>

### VIN OCR from Image

<CodeGroup title="app.php">
```php
<?php
try {
    $vinocr = $carsxe->vinOcr([
        'upload_url' => 'https://imagedelivery.net/moyiiSImjJPI_EZVxNMBBw/f49aed53-d736-4370-f3f4-97418841c800/public'
    ]);
    echo json_encode($vinocr, JSON_PRETTY_PRINT);
} catch (Exception $error) {
    echo "Error: " . $error->getMessage();
}
```
</CodeGroup>

### Year-Make-Model Search

<CodeGroup title="app.php">
```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();
}
```
</CodeGroup>

### OBD Code Decoder

<CodeGroup title="app.php">
```php
<?php
try {
    $obdcode = $carsxe->obdCodesDecoder([
        'code' => 'P0115'
    ]);
    echo json_encode($obdcode, JSON_PRETTY_PRINT);
} catch (Exception $error) {
    echo "Error: " . $error->getMessage();
}
```
</CodeGroup>

### Lien and Theft

<CodeGroup title="app.php">
```php
<?php
try {
    $lienAndTheft = $carsxe->lienAndTheft([
        'vin' => '2C3CDXFG1FH762860'
    ]);
    echo json_encode($lienAndTheft, JSON_PRETTY_PRINT);
} catch (Exception $error) {
    echo "Error: " . $error->getMessage();
}
```
</CodeGroup>

Start building powerful automotive applications with CarsXE's PHP SDK!
