PHPackages                             car-api-team/carapi-php-sdk - 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. car-api-team/carapi-php-sdk

ActiveLibrary[API Development](/categories/api)

car-api-team/carapi-php-sdk
===========================

SDK for CarAPI. The developer friendly vehicle API.

v2.0(1y ago)39.8k↑11.3%3MITPHPPHP ^7.4|^8.0

Since Nov 3Pushed 1y ago1 watchersCompare

[ Source](https://github.com/car-api-team/carapi-php-sdk)[ Packagist](https://packagist.org/packages/car-api-team/carapi-php-sdk)[ RSS](/packages/car-api-team-carapi-php-sdk/feed)WikiDiscussions main Synced today

READMEChangelog (9)Dependencies (11)Versions (11)Used By (0)

CarAPI PHP SDK
==============

[](#carapi-php-sdk)

[![Latest Version on Packagist](https://camo.githubusercontent.com/ec12baf4c728761b6eeef185cd3c6aaf01c21af1b0259b7cb5d53b8f2ef9eb99/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6361722d6170692d7465616d2f6361726170692d7068702d73646b2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/car-api-team/carapi-php-sdk)[![Build](https://github.com/car-api-team/carapi-php-sdk/actions/workflows/build.yml/badge.svg)](https://github.com/car-api-team/carapi-php-sdk/actions/workflows/build.yml)[![Coverage Status](https://camo.githubusercontent.com/ee72f30ddf628a128d68a246b49dab3c03e9a7f47dc1a41ff4872c92f3afd833/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f6361722d6170692d7465616d2f6361726170692d7068702d73646b2f62616467652e7376673f6272616e63683d6d61696e)](https://coveralls.io/github/car-api-team/carapi-php-sdk?branch=main)

PHP ^7.4 and ^8.0 compatible SDK for the developer friendly vehicle API. Please review our documentation for a better understanding of how this SDK works:

-
-

Install
-------

[](#install)

Install the SDK using [composer](https://getcomposer.org/):

```
composer require car-api-team/carapi-php-sdk
```

If your project has a discoverable HTTP client then the SDK will use that automatically. If it does not, you will need to add one. You can read more about HTTP discovery here:

Usage
-----

[](#usage)

Create the SDK instance using your token and secret. The following example assumes you've stored them in an `.env`file, but you may load them in as you please.

```
$sdk = \CarApiSdk\CarApi::build([
    'token' => getenv('CARAPI_TOKEN'),
    'secret' => getenv('CARAPI_SECRET'),
]);
```

You have now created an instance of the SDK. For Powersports use the following:

```
$sdk = \CarApiSdk\Powersports::build([
    'token' => getenv('CARAPI_TOKEN'),
    'secret' => getenv('CARAPI_SECRET'),
]);
```

### Other Options

[](#other-options)

You may also set `httpVersion` and `encoding`. The HTTP version defaults to 1.1 and we recommend keeping it at that version. Encoding is off by default, but GZIP is supported (note: you will need the zlib extension loaded). Example:

```
$sdk = \CarApiSdk\CarApi::build([
    'token' => getenv('CARAPI_TOKEN'),
    'secret' => getenv('CARAPI_SECRET'),
    'httpVersion' => '2.0', // we recommend keeping the default 1.1
    'encoding' => ['gzip'],
    'apiVersion' => 'v1' // the default is v2
]);
```

### Authentication

[](#authentication)

The authenticate method will both return a JWT and store the JWT in the SDK internally. There is no persistent storage offered, so you will need to handle caching in your application. We'll provide a basic cache example using the file system, but we recommend using your frameworks caching library or something like symfony/cache or cake/cache.

```
$filePath = '/some/path/not/readable/by/browsers/carapi_jwt.txt';
$jwt = file_get_contents($filePath);
if (empty($jwt) || $sdk->loadJwt($jwt)->isJwtExpired() !== false) {
    try {
        $jwt = $sdk->authenticate();
        file_put_contents($filePath, $jwt);
    } catch (\CarApiSdk\CarApiException $e) {
        // handle errors here
    }
}

// make your api calls here...
```

### Passing query parameters

[](#passing-query-parameters)

Query parameters can be passed to api endpoints as key-value arrays.

```
$sdk->years(['query' => ['make' => 'Tesla']]);
```

### Passing JSON searches

[](#passing-json-searches)

JSON search parameters can be passed to api endpoints as objects:

```
$json = (new \CarApiSdk\JsonSearch())
    ->addItem(new \CarApiSdk\JsonSearchItem('make', 'in', ['Tesla']));
$sdk->years(['query' => ['json' => $json]])
```

### Pagination

[](#pagination)

Endpoints supporting pagination will return a collection property storing the pagination metadata and a data property storing the actual results. Here is an example of paging through the `/api/makes` endpoint:

```
$page = 1;
do {
    $result = $sdk->makes(['query' => ['limit' => 1, 'page' => $page]]);
    $lastPage = $result->collection->pages;
    $page++;
    print_r($result->data);
} while ($page years();
foreach ($years as $year) {
    echo $year;
}
```

Get all years that Tesla sold cars:

```
$sdk->years(['query' => ['make' => 'Tesla']]);
```

### Makes

[](#makes)

Returns a collection.

```
foreach ($sdk->makes()->data as $make) {
    echo $make->name;
}
```

Get all makes for 2020:

```
$sdk->makes(['query' => ['year' => 2020]]);
```

### Models

[](#models)

Returns a collection.

```
foreach ($sdk->models()->data as $model) {
    echo $model->name;
}
```

Getting all 2020 Toyota models:

```
$sdk->models(['query' => ['year' => 2020, 'make' => 'Toyota']]);
```

### Submodels

[](#submodels)

Returns a collection.

```
foreach ($sdk->submodels()->data as $submodel) {
    echo $submodel->submodel;
}
```

Getting all 2020 Toyota Camry submodels:

```
$sdk->submodels(['query' => ['year' => 2020, 'make' => 'Toyota', 'model' => 'Camry']]);
```

### Trims

[](#trims)

Returns a collection.

```
foreach ($sdk->trims()->data as $trim) {
    echo $trim->name;
}
```

Getting all 2020 Ford F-150 trims:

```
$sdk->trims(['query' => ['year' => 2020, 'make' => 'Ford', 'model' => 'F-150']]);
```

Getting all 2020 Ford F-150 and F-250 trims:

```
$json = (new \CarApiSdk\JsonSearch())
    ->addItem(new \CarApiSdk\JsonSearchItem('model', 'in', ['F-150', 'F-250']));
$sdk->trims(['query' => ['year' => 2020, 'make' => 'Ford', 'json' => $json]]);
```

Get all sedans by Toyota or Ford in 2020:

```
$json = (new \CarApiSdk\JsonSearch())
    ->addItem(new \CarApiSdk\JsonSearchItem('make', 'in', ['Toyota', 'Ford']));
    ->addItem(new \CarApiSdk\JsonSearchItem('bodies.type', '=', 'Sedan'));
$result = $sdk->trims(['query' => ['year' => 2020, 'json' => $json]]);
foreach ($result->data as $trim) {
    echo $trim->name;
}
```

Or for a single trim an object is returned:

```
echo $sdk->trimItem($id)->name;
```

### Vin

[](#vin)

Returns an object

```
$sdk->vin('1GTG6CEN0L1139305');
```

Loop through all trims returned by a vin lookup:

```
foreach ($sdk->vin('1GTG6CEN0L1139305')->trims as $trim) {
    echo $trim->name;
}
```

### Bodies

[](#bodies)

Returns a collection.

```
foreach ($sdk->bodies()->data as $body) {
    echo $body->type;
}
```

### Engines

[](#engines)

Returns a collection.

```
foreach ($sdk->engines()->data as $engine) {
    echo $engine->engine_type;
}
```

### Mileages

[](#mileages)

Returns a collection.

```
$sdk->mileages();
```

### Interior Colors

[](#interior-colors)

Returns a collection.

```
$sdk->interiorColors();
```

### Exterior Colors

[](#exterior-colors)

Returns a collection.

```
$sdk->exteriorColors();
```

### License Plate

[](#license-plate)

Returns an object.

```
$sdk->licensePlate('US', 'LNP8460#TEST', 'NY');
```

### OBD Diagnostic Code Search

[](#obd-diagnostic-code-search)

Returns a collection.

```
$sdk->obdCodes();
```

### Get single OBD Diagnostic Code

[](#get-single-obd-diagnostic-code)

Returns an object.

```
$sdk->obdCodeItem('B1200');
```

### CSV Datafeed

[](#csv-datafeed)

Returns the datafeed as a ResponseInterface. You will need handle extracting the file out in your application.

```
$sdk->csvDataFeed();
```

### CSV Datafeed Last Update

[](#csv-datafeed-last-update)

Returns an object.

```
$sdk->csvDataFeedLastUpdated();
```

### Vehicle Attributes

[](#vehicle-attributes)

Returns an array of strings.

```
$sdk->vehicleAttributes('bodies.type');
```

### Account Requests

[](#account-requests)

Returns an array of objects.

```
$sdk->accountRequests();
```

### Account Requests Today

[](#account-requests-today)

Returns an object:

```
$sdk->accountRequestsToday();
```

###  Health Score

39

—

LowBetter than 84% of packages

Maintenance47

Moderate activity, may be stable

Popularity31

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity54

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 ~72 days

Recently: every ~49 days

Total

9

Last Release

396d ago

Major Versions

v1.4.0 → v2.02025-06-03

### Community

Maintainers

![](https://www.gravatar.com/avatar/b46339adc373ed28ab24edbc5aef0a2b68a619f16946c85f5ee0c72e6ee0c1e5?d=identicon)[carapidev](/maintainers/carapidev)

---

Top Contributors

[![vimalgorasiya](https://avatars.githubusercontent.com/u/12136812?v=4)](https://github.com/vimalgorasiya "vimalgorasiya (1 commits)")

---

Tags

car-apimotorcycle-apiobd-code-apivehicle-apivin-api

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/car-api-team-carapi-php-sdk/health.svg)

```
[![Health](https://phpackages.com/badges/car-api-team-carapi-php-sdk/health.svg)](https://phpackages.com/packages/car-api-team-carapi-php-sdk)
```

###  Alternatives

[telnyx/telnyx-php

Official Telnyx PHP SDK — APIs for Voice, SMS, MMS, WhatsApp, Fax, SIP Trunking, Wireless IoT, Call Control, and more. Build global communications on Telnyx's private carrier-grade network.

35789.4k2](/packages/telnyx-telnyx-php)[openai-php/client

OpenAI PHP is a supercharged PHP API client that allows you to interact with the Open AI API

5.8k28.0M318](/packages/openai-php-client)[deeplcom/deepl-php

Official DeepL API Client Library

2607.3M115](/packages/deeplcom-deepl-php)[n1ebieski/ksef-php-client

PHP API client that allows you to interact with the API Krajowego Systemu e-Faktur

9067.8k](/packages/n1ebieski-ksef-php-client)[trycourier/courier

Courier PHP SDK

15660.9k](/packages/trycourier-courier)[getbrevo/brevo-php

Official Brevo provided RESTFul API V3 php library

1003.9M50](/packages/getbrevo-brevo-php)

PHPackages © 2026

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