Skip to content

Commit f15eccf

Browse files
authored
Update README.md
1 parent 20ab506 commit f15eccf

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

README.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,43 @@
11
# PHP EspoCRM API client
2+
3+
Require with Composer:
4+
5+
```
6+
composer require espocrm/php-espo-api-client
7+
```
8+
9+
Usage:
10+
11+
```
12+
use Espo\ApiClient\Client;
13+
use Espo\ApiClient\Header;
14+
use Espo\ApiClient\Exception\ResponseError;
15+
16+
$client = new Client($yourEspoUrl);
17+
$client->setApiKey($apiKey);
18+
$client->setSecretKey($secretKey); // if you use HMAC method
19+
20+
try {
21+
$response = $client->request(
22+
Client::METHOD_POST,
23+
'Lead',
24+
[
25+
'firstName' => $firstName,
26+
'lastName' => $lastName,
27+
'emailAddress' => $emailAddress,
28+
],
29+
[
30+
new Header('X-Skip-Duplicate-Check', 'true')
31+
]
32+
);
33+
34+
$parsedBody = $response->getParsedBody();
35+
}
36+
catch (ResponseError $e) {
37+
// Error response.
38+
$response = $e->getResponse();
39+
40+
$code = $response->getCode();
41+
$body = $response->getBody();
42+
}
43+
```

0 commit comments

Comments
 (0)