Download the PHP package jlecter/checkvin-php-api-client without Composer

On this page you can find all versions of the php package jlecter/checkvin-php-api-client. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package checkvin-php-api-client

CheckVin API client

CONTENTS OF THIS FILE

CheckVin API client is a package for a convenient working with CheckVin API.

KEY PACKAGES / EXTENSIONS

Run: composer require jlecter/checkvin-php-api-client:^1.0.1

USAGE

  1. Choose provider what do you need. Available now:

    • AutocheckDataProvider
    • BalanceDataProvider
    • CarfaxDataProvider
    • VehicleDataProvider
  2. Use it by passing inside your API key and calling available methods.

  3. Get a response object with such available methods:
    • "isSuccess" (returns true/false depends on response)
    • "getData" (returns empty array while error response)
    • "getError" (returns object while error response, null while success)

Error object methods (CheckVin\Api\Http\Data\Error):

VIN validation (client-side, before any HTTP request):

All VIN-based endpoints validate the supplied VIN before making any HTTP call. The VIN is trimmed, stripped of dashes and spaces, uppercased and then checked for:

An invalid VIN throws CheckVin\Api\Exception\InvalidVinCode (extends \InvalidArgumentException, implements CheckVinApiException). The original package exception is available via getPrevious().

Note: report endpoints (getAutoCheckForVinCode, checkReportExists, getCarfaxForVinCode) only accept North-American VINs (WMI starting with 1–5). A non-North-American VIN that happens to pass the check-digit may be accepted client-side but will be rejected by the API with HTTP 422 "Vincode Invalid. Auto not from North America.". The vehicle/info endpoint (getInfo) is less strict server-side — non-NA VINs were accepted in testing — but client-side validation still requires a valid checksum.

Basic usage — CheckVin facade (recommended):

The CheckVin class is the recommended entry-point. It accepts your API key once, resolves the HTTP client once, and lazily creates each provider on demand while sharing the same client across all of them.

All four providers are available through the facade:

Alternative: instantiate providers directly

You can still create each provider individually when you only need one, or when you need different configuration per provider:

Custom host and timeouts:

Catching transport failures:

API BEHAVIOUR NOTES

Balance: getData()['message'] is a number (float), not a string. For example: 12.6.

Invalid API key: the server responds with HTTP 422 (not 401/403) and {"message":"Пользователь не найден"}. This status is identical to a validation error; distinguish by the message text when necessary.

Validation errors (422): follow Laravel format. getErrors() returns an object where each key is a field name and the value is an array of messages:

checkReportExists (carfax and autocheck):

Rate limit: 60 requests per minute. The server sends X-Ratelimit-Limit and X-Ratelimit-Remaining headers, but these are not exposed by the client; handle HTTP 429 via getError()->getHttpCode().

Full report response shapes:

Autocheck (getAutoCheckForVinCode): vin (decoded as [] — server quirk, returns {} instead of a VIN string), has_autocheck (bool), updated_at (ISO 8601 datetime string), autocheck_data (HTML string), link (string).

Carfax (getCarfaxForVinCode): vin (string), hash (string), has_carfax (bool), updated_at ("HH:MM:SS DD-MM-YYYY" format — different from autocheck's ISO 8601), carfax_data (HTML string), link (string, may contain a double slash in the path — server quirk).

Vehicle info (getInfo): data → {brand, model, vin, year (int), engine_fuel, engine_hp (int)}.

USING YOUR OWN HTTP CLIENT (PSR-18)

By default the SDK uses its built-in curl client. If you need connection pooling, retries, a proxy, or any other transport feature, pass any PSR-18-compatible HTTP client to the provider instead.

Install the adapter and a PSR-7 factory (only needed by callers that use Psr18Client; the SDK itself has no runtime dependency on these packages):

Wire it up:

Note: timeouts, retries, and proxy settings must be configured on the PSR-18 client directly. Psr18Client does not apply any timeouts of its own.

Transport errors thrown by the PSR-18 client (Psr\Http\Client\ClientExceptionInterface) are mapped to CheckVin\Api\Exception\RequestFailed, with the original exception available via getPrevious().

UPGRADING FROM 0.x

1.0 introduces the following breaking changes:

  1. PHP >= 8.1 required. PHP 7.4 and 8.0 are no longer supported.

  2. Config constructor now accepts parameters. Old: new Config() — no parameters, uses hard-coded internal defaults. New: new Config(string $host, int $connectTimeoutMs, int $timeoutMs) — all optional. Config is now final. Default timeouts changed: connect timeout is now 10 000 ms (10 s), total timeout is now 60 000 ms (60 s). Previously there was no total timeout and the curl default connect timeout applied. A trailing slash on $host is silently trimmed, so https://host/ and https://host behave identically. connectTimeoutMs <= 0 or timeoutMs <= 0 throws CheckVin\Api\Exception\InvalidConfig (extends \InvalidArgumentException). timeoutMs < connectTimeoutMs also throws InvalidConfig — a total timeout shorter than the connect timeout would make the connect timeout unreachable.

  3. All four providers accept an optional ClientInterface as second constructor argument. Old: new AutocheckDataProvider('key'). New: new AutocheckDataProvider('key', ?ClientInterface $client = null). Existing call sites continue to work unchanged.

  4. VehicleDataProvider::getInfo() now requires a $vinCode argument. Old (broken — caused a fatal ArgumentCountError at runtime): $provider->getInfo(). New: $provider->getInfo(string $vinCode): ApiResponse. The matching interface VehicleDataProviderInterface is updated accordingly.

  5. Malformed / non-JSON response bodies no longer cause a TypeError. Old: a curl response that is not a JSON object (HTML error page, empty body, truncated response) caused a TypeError (null passed to array parameter) even on HTTP 200. New: those cases return an error ApiResponse (isSuccess() === false). The error message now includes the HTTP status, e.g. "Malformed response body (HTTP 200)". A 200 response with a non-JSON body is also treated as an error. 1.0 also treats a JSON list (e.g. [1,2,3], []) as a malformed body — the API contract requires a JSON object. An empty object {} remains valid.

  6. \LogicException replaced by CheckVin\Api\Exception\RequestFailed. Old: curl transport errors threw \LogicException. New: they throw CheckVin\Api\Exception\RequestFailed (extends \RuntimeException, implements CheckVin\Api\Exception\CheckVinApiException). Update any catch (\LogicException $e) blocks.

  7. Most concrete classes are now final. The following classes cannot be extended: Config, Client, ClientResponse, Error, ApiResponse, ApiUriGlossary, AutocheckDataProvider, BalanceDataProvider, CarfaxDataProvider, VehicleDataProvider. If you were extending any of these, compose instead.

  8. ClientInterface::makeResponse() has been removed. Old: ClientInterface had both request() and makeResponse(). New: ClientInterface only has request(). Response mapping is handled by ApiResponse::fromClientResponse(ClientResponse): ApiResponse. Update custom ClientInterface implementations and any direct calls to $client->makeResponse().

  9. AutoCheckDataProviderInterface renamed to AutocheckDataProviderInterface. Old: CheckVin\Api\Provider\Autocheck\AutoCheckDataProviderInterface. New: CheckVin\Api\Provider\Autocheck\AutocheckDataProviderInterface. Update any type hints, implements clauses, and use statements referencing the old name.

  10. Client-side VIN validation is now enforced before any HTTP request. Calling any VIN-based endpoint (getAutoCheckForVinCode, checkReportExists, getCarfaxForVinCode, getInfo) with an invalid VIN now throws CheckVin\Api\Exception\InvalidVinCode (extends \InvalidArgumentException) before any network call is made. Previously, the raw string was forwarded to the API and validation errors came back as HTTP 4xx responses. The underlying package exception (LengthNotValidException, NotValidLetterException, or CheckSumNotValidException from checkvin/vincode) is available via $e->getPrevious(). Only North-American VINs (valid check digit at position 9) are accepted. A new Composer dependency checkvin/vincode ^1.0 is required.

  11. Response class hierarchy collapsed into a single ApiResponse. Old: Abstraction\ApiResponse → Abstraction\ErrorResponse / Abstraction\SuccessResponse → Error\ApplicationErrorResponse / Success\ApplicationSuccessResponse. New: one final class ApiResponse at CheckVin\Api\Http\Response\ApiResponse with a named constructor ApiResponse::fromClientResponse(ClientResponse): ApiResponse.
    • Replace any use CheckVin\Api\Http\Response\Abstraction\ApiResponse with use CheckVin\Api\Http\Response\ApiResponse.
    • Replace instanceof ErrorResponse / instanceof ApplicationErrorResponse checks with !$response->isSuccess().
    • Replace instanceof SuccessResponse / instanceof ApplicationSuccessResponse checks with $response->isSuccess().
    • SuccessResponse::SUCCESS_CODE (= 200) has no public replacement; remove references to it.

All versions of checkvin-php-api-client with dependencies

PHP Build Version
Package Version
Requires php Version >=8.1
ext-curl Version *
ext-json Version *
checkvin/vincode Version ^1.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package jlecter/checkvin-php-api-client contains the following files

Loading the files please wait ...