PHPackages                             amattu2/carfax-wrapper - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. amattu2/carfax-wrapper

ActiveLibrary[API Development](/categories/api)

amattu2/carfax-wrapper
======================

A CARFAX vehicle history reporting helper class. Offers support for sending reports to the CARFAX VHR, decoding a license plate to VIN, and pulling CARFAX stored service history data.

v1.0.3(1y ago)17591AGPL-3.0-or-laterPHPPHP &gt;=7.4.0

Since Jun 5Pushed 1y ago2 watchersCompare

[ Source](https://github.com/amattu2/CARFAX-Wrapper)[ Packagist](https://packagist.org/packages/amattu2/carfax-wrapper)[ RSS](/packages/amattu2-carfax-wrapper/feed)WikiDiscussions master Synced 4w ago

READMEChangelog (8)DependenciesVersions (6)Used By (0)

Introduction
============

[](#introduction)

This is a CARFAX Vehicle History Reporting, QuickVIN, and Service History Check integration toolkit. It provides the interface to achieve the following results:

- Report your DMS/SMS vehicle repair ticket history
- Perform a QuickVIN search
- Perform a Search History Check

As achieved through proprietary APIs and integration procedures. Using this PHP based toolkit is not possible without an existing CARFAX Service Data Transfer Facilitation Agreement, and it relies on API keys that are not publicly subscribable.

Usage
=====

[](#usage)

Install &amp; Setup
-------------------

[](#install--setup)

```
composer require amattu2/carfax-wrapper
```

```
require_once "vendor/autoload.php";

// see examples/..
```

> **Note**: For the examples in [/examples](./examples/), the [config.ini.example](./examples/config.ini.example) must be renamed to `config.ini` and updated with your CARFAX credentials.

---

FTP
---

[](#ftp)

This is a helper class for reporting repair data to the CARFAX VHR system. It substantially eases the load required of a developer to implement CARFAX vehicle history reporting from a proprietary DMS/SMS system.

### constructor

[](#constructor)

Initialize the class component using the constructor

```
$wrapper = new CARFAX\FTP();
```

```
/**
 * Class Constructor
 *
 * @param string $username CARFAX FTP username
 * @param string $password CARFAX FTP password
 * @param ?string $partner_name CARFAX Partner Name
 * @param ?string $type Data Report Type ("HIST" or "PROD")
 * @param ?DateTime $date Data Report Date
 * @throws None
 * @author Alec M.
 */
public function __construct(string $username, string $password, string $partner_name = "", string $type = "PROD", \DateTime $date = null);
```

---

### write(array $data, $handle = null) : bool

[](#writearray-data-handle--null--bool)

Write a single record to the export file. Please Note: **This function DOES NOT validate field values. It only writes what was provided.** Your implementation of the class will need to validate Repair Order field values. **This ONLY ensures that the field is present in the array.**

```
$success = $wrapper->write([
  /* See class HEADER_FIELDS for a list of fields that are REQUIRED */
]);
```

### writeAll(array $data) : int

[](#writeallarray-data--int)

Write an array of repair orders to the report file. This is an efficient wrapper to the `write()` method, and maintains a file handle at all times. If you are able to write a multitude of Repair Orders at a single time, use this. Please Note: **This function DOES NOT validate field values. It only writes what was provided.** Your implementation of the class will need to validate Repair Order field values. **This ONLY ensures that the field is present in the array.**

```
$successes = $wrapper->writeAll(
  [
    [
      /* Repair order record */
    ],
    [
      /* Repair order record */
    ],

    // ...
  ]
);
```

### upload() : bool

[](#upload--bool)

Submit the generated record to the CARFAX FTP endpoint.

```
$wrapper->upload();
```

### cleanUp() : bool

[](#cleanup--bool)

This is an entirely optional function that will delete the Repair Order file from the local server. It should be called after uploading it to the FTP server.

```
$isCleaned = $wrapper->cleanUp();
```

### getTotalRecords() : int

[](#gettotalrecords--int)

This returns the total number of repair orders written to the report file. Does not include the header line.

```
$numRecords = $wrapper->getTotalRecords();
```

### getFilePath() : ?string

[](#getfilepath--string)

This returns the fully-qualified path to the report file if the file exists.

### getFileName() : ?string

[](#getfilename--string)

This returns the filename of the report file if it exists.

---

ServiceHistory
--------------

[](#servicehistory)

This is a entirely static class used to fetch repair history data from CARFAX by a vehicle VIN.

### setLocationId(string $locationId) : void

[](#setlocationidstring-locationid--void)

Update the Location ID for the current *instance* of the class. This is provided by CARFAX at the time of account setup.

```
CARFAX\ServiceHistory::setLocationId("exampleLOC");
```

### setProductDataId(string $productDataId) : void

[](#setproductdataidstring-productdataid--void)

Update the Product Data ID for the current *instance* of the class. It is the equivelent of a API key, and is CARFAX defined at the time of account setup.

```
CARFAX\ServiceHistory::setProductDataId("exampleProductDataId");
```

### get(string $VIN) : array

[](#getstring-vin--array)

This is the actual function exposed for fetching the vehicle history by VIN number. If you do not have the locationId or productDataId set, errors will be thrown. Everything else is error safe, including CARFAX API failures. The function will always return an array or throw an error.

If a record (Overview or History) does NOT have a valid:

- Odometer, it will be equal to `0`
- Date, it will be equal to `NULL`

```
$data = CARFAX\ServiceHistory::get("1G1GCCBX3JX001788");
```

 Abbreviated example response```
{
  "Decode": {
    "VIN": "1G1GCCBX4JX001298",
    "Year": "2011",
    "Make": "CADILLAC",
    "Model": "LUXURY",
    "Trim": "",
    "Driveline": ""
  },
  "Overview": [
    {
      "Name": "Tire rotation",
      "Date": "12/24/2013",
      "Odometer": 42185
    },
    {
      "Name": "Emissions test",
      "Date": "04/20/2021",
      "Odometer": 127005
    },
    {
      "Name": "Battery Replacement",
      "Date": "11/21/2019",
      "Odometer": 112682
    },
  ],
  "Records": [
    {
      "Date": "01/12/2011",
      "Odometer": 5,
      "Services": [
        "Vehicle serviced",
        "Pre-delivery inspection completed",
        "Window tint installed",
        "Vehicle washed/detailed",
        "Tire condition and pressure checked",
        "Nitrogen fill tires",
        "Anti-theft/keyless device/alarm installed",
        "Safety inspection performed"
      ],
      "Type": "Service"
    },
    {
      "Date": null,
      "Odometer": 92500,
      "Services": [
        "Title issued or updated",
        "Registration issued or renewed",
        "Passed safety inspection",
        "Vehicle color noted as Brown"
      ],
      "Type": "Service"
    },
    {
      "Date": "06/25/2021",
      "Odometer": 0,
      "Services": [
        "Manufacturer Safety recall issued",
        "NHTSA #21V573",
        "Recall #N213240870",
        "Status: Remedy Available"
      ],
      "Type": "Recall"
    }
  ]
}
```

> **Note**: See the examples in [servicehistory-get.php](./examples/servicehistory-get.php)

---

QuickVIN
--------

[](#quickvin)

The QuickVIN Plus class is a wrapper for the CARFAX QuickVIN Plus decoder API. It turns a license plate + state into a VIN number with a VIN decode. It is a static class, and does not require instantiation.

### setLocationId(string $locationId): void

[](#setlocationidstring-locationid-void)

Update the Location ID for the current *instance* of the class. This is provided by CARFAX at the time of account setup.

```
CARFAX\QuickVIN::setLocationId("exampleLOC");
```

### setProductDataId(string $productDataId): void

[](#setproductdataidstring-productdataid-void)

Update the Product Data ID for the current *instance* of the class. It is the equivelent of a API key, and is CARFAX defined at the time of account setup.

```
CARFAX\QuickVIN::setProductDataId("exampleProductDataId");
```

### decode(string $plate, string $state, ?string $VIN = null): ?SimpleXMLElement

[](#decodestring-plate-string-state-string-vin--null-simplexmlelement)

Perform a plate+state to VIN decode. If the decode is successful, a SimpleXMLElement object will be returned. If the decode is unsuccessful, `NULL` will be returned.

```
$xml = CARFAX\QuickVIN::decode("HELLO", "VA");
```

> **Note**: See the examples in [quickvin-decode.php](./examples/quickvin-decode.php)

Requirements &amp; Dependencies
===============================

[](#requirements--dependencies)

- PHP 7.4+
- SimpleXML
- cURL

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance32

Infrequent updates — may be unmaintained

Popularity17

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity51

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~177 days

Total

5

Last Release

726d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/45d27ac587ba85712309c969ca2e277df1044c60ce9f2f8a5ca69118211e30d6?d=identicon)[amattu2](/maintainers/amattu2)

---

Top Contributors

[![amattu2](https://avatars.githubusercontent.com/u/38357871?v=4)](https://github.com/amattu2 "amattu2 (68 commits)")

---

Tags

apicarfaxphpwrapper

### Embed Badge

![Health badge](/badges/amattu2-carfax-wrapper/health.svg)

```
[![Health](https://phpackages.com/badges/amattu2-carfax-wrapper/health.svg)](https://phpackages.com/packages/amattu2-carfax-wrapper)
```

###  Alternatives

[stripe/stripe-php

Stripe PHP Library

4.0k143.3M475](/packages/stripe-stripe-php)[twilio/sdk

A PHP wrapper for Twilio's API

1.6k92.9M270](/packages/twilio-sdk)[knplabs/github-api

GitHub API v3 client

2.2k15.8M186](/packages/knplabs-github-api)[facebook/php-business-sdk

PHP SDK for Facebook Business

90121.9M33](/packages/facebook-php-business-sdk)[microsoft/microsoft-graph

The Microsoft Graph SDK for PHP

65723.5M95](/packages/microsoft-microsoft-graph)[meilisearch/meilisearch-php

PHP wrapper for the Meilisearch API

73813.7M114](/packages/meilisearch-meilisearch-php)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
