Skip to content

Commit

Permalink
updated readme.md and models
Browse files Browse the repository at this point in the history
  • Loading branch information
vasildakov committed Dec 28, 2023
1 parent 26caf57 commit 5b9a1af
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 6 deletions.
63 changes: 59 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Econt API Client
# Econt API Client [WIP]

![example workflow](https://github.com/vasildakov/econt/actions/workflows/php.yml/badge.svg)
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/vasildakov/econt/badges/quality-score.png?b=main)](https://scrutinizer-ci.com/g/vasildakov/econt/?branch=main)
Expand All @@ -19,7 +19,20 @@ Using Composer:
$ composer require vasildakov/econt
```

## Usage
## Tests

Running unit tests:

```
$ ./vendor/bin/phpunit --coverage-html ./build/coverage
```


## Configuration

The Econt API Client can be configured with any PSR-18 HTTP Client and PSR-17 HTTP Factory implementations.
In the following example we use [Guzzle](https://github.com/guzzle/guzzle) and [Diactoros](https://github.com/laminas/laminas-diactoros)
to configure the client:

```php

Expand All @@ -41,6 +54,48 @@ $client = new Client();
$factory = new RequestFactory();

$econt = new Econt($configuration, $client, $factory);
```


## Usage

The Client provides a public API for communication with the Econt API

```php
<?php

$econt = new Econt($configuration, $client, $factory);
$json = $econt->getClientProfiles(); // json
```

The returned json response can be decoded to associative array or php class:

```php
<?php

$array = json_decode($json);
var_dump($array);
```

The json response can be also deserialized to an object:

```php
<?php

use VasilDakov\Econt\Serializer\SerializerFactory;

$serializer = (new SerializerFactory())();

$json = $econt->getClientProfiles();
$object = $serializer->deserialize($json, GetClientProfilesResponse::class, 'json');
```

## Notes

For more information you can check the official Econt API [documentation](https://www.econt.com/developers/soap-json-api.html).

The available API services can be found [here](https://ee.econt.com/services/).

## License

var_dump($econt->getClientProfiles());
```
Code released under [the MIT license](https://github.com/vasildakov/postcode/blob/master/LICENSE)
2 changes: 0 additions & 2 deletions src/Model/Error.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@ public function toArray(): array
Constants::MESSAGE => $this->message,
Constants::FIELDS => $this->fields,
Constants::INNER_ERRORS => $this->innerErrors


];
}
}

0 comments on commit 5b9a1af

Please sign in to comment.