roboteam-digital/retailcrm-api-client-php-extended

PHP client for retailCRM API extended by RoboTeam-Digital


Keywords
rest, api, retailCRM, Roboteam
License
MIT

Documentation

Extended retailcrm/api-client-php with more methods

This is php retailCRM API client. This library allows to use all available API versions. API documentation

Requirements

  • PHP 5.4 and above
  • PHP's cURL support
  • PHP's JSON support
  • PHP's Fileinfo support

Install

  1. Get composer

  2. Run into your project directory:

composer require roboteam-digital/retailcrm-api-client-php-extended v0.1.0

If you have not used composer before, include autoloader into your project.

require 'path/to/vendor/autoload.php';

Usage

Get order

$client = new \RoboTeam\RetailCrmApiClientExtended(
    'https://demo.retailcrm.ru',
    'T9DMPvuNt7FQJMszHUdG8Fkt6xHsqngH',
    \RetailCrm\ApiClient::V5
);

$date = '2019-10-09';
$filter['startDate'] = $date . ' 00:00:00';
$filter['endDate'] = $date . ' 23:59:59';

// try {
//     $response = $retailcrm->ordersTransitions($filter);
// } catch (\Throwable $th) {
//     echo 'some error';
//     // echo 'Connection error: ' . $e->getMessage();
// }

$response = $retailcrm->ordersTransitions($filter);
print_r($response);

Output will be look something like this:

Array
(
    [0] => Array
        (
            [createdAt] => 2019-10-09 00:02:49
            [oldValue] => call-assigned
            [newValue] => calc-price
        )

    [1] => Array
        (
            [createdAt] => 2019-10-09 00:09:02
            [oldValue] => 
            [newValue] => new-from-phone-roistat
        )

    [2] => Array
        (
            [createdAt] => 2019-10-09 00:09:03
            [oldValue] => new-from-phone-roistat
            [newValue] => new-missed-call-roistat
        )

    [3] => Array
        (
            [createdAt] => 2019-10-09 00:16:34
            [oldValue] => new
            [newValue] => call-assigned
        )

    [4] => Array
        (
            [createdAt] => 2019-10-09 00:18:44
            [oldValue] => new-missed-call-roistat
            [newValue] => test
        )
)