From 5a9c0bdb7b5959c514697c39a94c5b47a9a1c3b2 Mon Sep 17 00:00:00 2001 From: Ilyas Salikhov Date: Thu, 6 Nov 2014 02:55:09 +0300 Subject: [PATCH] Added example of usage --- README.md | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/README.md b/README.md index 16ad6d8..a9f5326 100644 --- a/README.md +++ b/README.md @@ -18,3 +18,29 @@ Installation ```bash composer require retailcrm/api-client-php 3.0 ``` + +Usage +----- + +Example of the usage: +```php + +$client = new \RetailCrm\ApiClient( + 'https://demo.intarocrm.ru', + 'T9DMPvuNt7FQJMszHUdG8Fkt6xHsqngH' +); + +try { + $response = $client->ordersGet('M-2342'); +} catch (\RetailCrm\Exception\CurlException $e) { + echo "CRM connection error: " . $e->getMessage(); +} + +if ($response->isSuccessful()) { + echo $response->order['totalSumm']; + // or $response['order']['totalSumm']; + // or + // $order = $response->getOrder(); + // $order['totalSumm']; +} +``` \ No newline at end of file