crtdev/crt-php-client

PHP Client for CRT REST API


Keywords
api, client, crt
License
Apache-2.0

Documentation

CrtPhpClient

Requirements

  • PHP 5.3 or later
  • php-curl

Getting Started

Downdload and unzip

$ wget https://github.com/CrtDev/CrtPhpClient/archive/master.zip
$ unzip master.zip
<?php

require_once('CrtPhpClient-master/init.php');

use CrtPhpClient\Crt;

$crt = new Crt();

$models = $crt->catalog()
    ->mark('TOYOTA')
    ->market('JAPAN')
    ->model();

print_r($models);

// Array
//  (
//     [0] => ALLEX
//     [1] => ALLION
//     [2] => ALPHARD
//     ...

Installation via Composer

$ composer require crtdev/crt-php-client:1.*@dev
<?php
require __DIR__.'/vendor/autoload.php';

use CrtPhpClient\Crt;

$crt = new Crt();
print_r($crt->catalog()->mark());

// Array
//   (
//       [0] => AUDI
//       [1] => BMW
//       [2] => CHEVROLET
//       ...

Tests

$ composer require crtdev/crt-php-client:1.*@dev
$ phpunit vendor/crtdev/crt-php-client

API documentation

You can browse the whole documentation at crt.ru/api/doc.

There is an optional api format - .json and .xml:

By calling an URL with the parameter ?_doc=1, you will get the corresponding documentation: