Download the PHP package amattu2/carfax-wrapper without Composer
On this page you can find all versions of the php package amattu2/carfax-wrapper. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download amattu2/carfax-wrapper
More information about amattu2/carfax-wrapper
Files in amattu2/carfax-wrapper
Package carfax-wrapper
Short Description 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.
License AGPL-3.0-or-later
Informations about the package carfax-wrapper
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
Install & Setup
Note: For the examples in config.ini.example must be renamed to
config.ini
and updated with your CARFAX credentials.
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
Initialize the class component using the constructor
write(array $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.
writeAll(array $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.
upload() : bool
Submit the generated record to the CARFAX FTP endpoint.
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.
getTotalRecords() : int
This returns the total number of repair orders written to the report file. Does not include the header line.
getFilePath() : ?string
This returns the fully-qualified path to the report file if the file exists.
getFileName() : ?string
This returns the filename of the report file if it exists.
ServiceHistory
This is a entirely static class used to fetch repair history data from CARFAX by a vehicle VIN.
setLocationId(string $locationId) : void
Update the Location ID for the current instance of the class. This is provided by CARFAX at the time of account setup.
setProductDataId(string $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.
get(string $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
Abbreviated example response
Note: See the examples in servicehistory-get.php
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
Update the Location ID for the current instance of the class. This is provided by CARFAX at the time of account setup.
setProductDataId(string $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.
decode(string $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.
Note: See the examples in quickvin-decode.php
Requirements & Dependencies
- PHP 7.4+
- SimpleXML
- cURL
All versions of carfax-wrapper with dependencies
ext-curl Version *
ext-simplexml Version *
ext-xml Version *