Download the PHP package car-api-team/carapi-php-sdk without Composer

On this page you can find all versions of the php package car-api-team/carapi-php-sdk. 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 carapi-php-sdk

CarAPI PHP SDK

Latest Version on Packagist Build Coverage Status

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 the SDK using composer:

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: https://github.com/php-http/discovery

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.

You have now created an instance of the SDK.

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:

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.

Passing query parameters

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

Passing JSON searches

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

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:

Exceptions

The SDK will throw \CarApiSdk\CarApiException on errors. In some cases, this is just catching and rethrowing underlying HTTP Exceptions or JSON Exceptions. In most cases, this will capture errors from the API response and format them into a CarApiException.

Years

The years method returns an array of integers.

Get all years that Tesla sold cars:

Makes

Returns a collection.

Get all makes for 2020:

Models

Returns a collection.

Getting all 2020 Toyota models:

Trims

Returns a collection.

Getting all 2020 Ford F-150 trims:

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

Get all sedans by Toyota or Ford in 2020:

Or for a single trim an object is returned:

Vin

Returns an object

Loop through all trims returned by a vin lookup:

Bodies

Returns a collection.

Engines

Returns a collection.

Mileages

Returns a collection.

Interior Colors

Returns a collection.

Exterior Colors

Returns a collection.

CSV Datafeed

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

CSV Datafeed Last Update

Returns an object.

Vehicle Attributes

Returns an array of strings.

Account Requests

Returns an array of objects.

Account Requests Today

Returns an object:


All versions of carapi-php-sdk with dependencies

PHP Build Version
Package Version
Requires php Version ^7.4|^8.0
ext-json Version *
php-http/discovery Version ^1.19
psr/http-client-implementation Version ^1.0
psr/http-factory-implementation 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 car-api-team/carapi-php-sdk contains the following files

Loading the files please wait ....