h4kuna / ares
Provides information about subjects by their identification number from the ARES database (in Czech Republic).
Requires
- php: >=8.0
- ext-curl: *
- ext-json: *
- ext-simplexml: *
- nette/utils: ^2.0 || ^3.0 || ^4.0
- psr/http-factory: ^1.0
- psr/http-message: ^1.0.1 || ^2.0
Requires (Dev)
- guzzlehttp/guzzle: ^7.5
- nette/tester: ^2.4
- phpstan/phpstan: ^2.1
- phpstan/phpstan-strict-rules: ^2.0
- tracy/tracy: ^2.9
Suggests
- guzzlehttp/guzzle: As default implementation for PSR-7, PSR-17 and PSR-18 standards.
Provides
None
Conflicts
None
Replaces
None
- dev-master
- dev-main
- v3.0.14
- v3.0.13
- v3.0.12
- v3.0.11
- v3.0.10
- v3.0.9
- v3.0.8
- v3.0.7
- v3.0.6
- v3.0.5
- v3.0.4
- v3.0.3
- v3.0.2
- v3.0.1
- v3.0.0
- v2.0.5
- v2.0.4
- v2.0.3
- v2.0.2
- v2.0.1
- v2.0.0
- v1.4.14
- v1.4.13
- v1.4.12
- v1.4.11
- v1.4.10
- v1.4.9
- v1.4.8
- v1.4.7
- v1.4.6
- v1.4.5
- v1.4.4
- v1.4.3
- v1.4.2
- v1.4.1
- v1.4.0
- v1.3.0
- v1.2.0
- v1.1.3
- v1.1.2
- v1.1.1
- v1.1.0
- v1.0.7
- v1.0.6
- v1.0.5
- v1.0.4
- v1.0.3
- v1.0.2
- v1.0.1
- v1.0.0
- dev-update-phpstan
- dev-ic-26005492
- dev-address-fallback
This package is auto-updated.
Last update: 2026-09-25 11:05:30 UTC
README
Part of the h4kuna PHP libraries, see the overview of all packages.
More information about versions is in changelog.
Support development by QR code
Use the QR code or the sponsor button, which links to my Revolut.
Thank you :)
Installation to project
Requires PHP 8.0 or newer. The best way to install h4kuna/ares is using Composer:
composer require h4kuna/ares
# optional, default implementation of PSR-7, PSR-17 and PSR-18 used by AresFactory
composer require guzzlehttp/guzzle
Without Guzzle, pass your own PSR-18 client and PSR-17 factories to the AresFactory constructor.
The library downloads information about a subject by its identification number (IČO).
ARES
Load data by one identification number. Shorter numbers are padded with leading zeros to 8 digits.
use h4kuna\Ares; $ares = (new Ares\AresFactory())->create(); try { $response = $ares->loadBasic('87744473'); /* @var $response Ares\Ares\Core\Data */ var_dump($response); } catch (Ares\Exception\IdentificationNumberNotFoundException $e) { // the identification number does not exist, log it or ignore it } catch (Ares\Exception\AdisResponseException $e) { // validation by ADIS failed, but ARES returned the data /* @var $response Ares\Ares\Core\Data */ $response = $e->data; $response->adis === null; // true var_dump($e->getMessage()); } catch (Ares\Exception\ServerResponseException $e) { // no response from server or broken json }
Load data by many identification numbers. The ARES service accepts at most 100 items per request, the library splits the input into chunks and removes duplicates. The result is a Generator that keeps the keys of the input array and contains only the subjects that exist.
use h4kuna\Ares; /** @var Ares\Ares $ares */ $numbers = ['one' => '25596641', 'two' => '26713250', 'three' => '27082440', 'four' => '11111111']; try { foreach ($ares->loadBasicMulti($numbers) as $name => $r) { var_dump($name, $r->company); } } catch (Ares\Exception\ResultException | Ares\Exception\ServerResponseException $e) { // error response, no response from server or broken json }
Other endpoints
Choose an endpoint from the class Sources.
SERVICE_*- other available endpointsCORE- the main endpoint, used by the method$ares->loadBasic()DIAL- code lists (dials), for examplePravniFormaSER_NO_*- not supported
Runnable examples are in bin.
use h4kuna\Ares; /** @var Ares\Ares $ares */ $result = $ares->getAresClient()->useEndpoint(Ares\Ares\Sources::SERVICE_VR, '27082440'); var_dump($result);
Dials
You can find the parameters kodCiselniku and zdrojCiselniku in the JSON file AresRestApi-verejne_v*.json, for example ciselnikKod: PravniForma, zdroj: res.
use h4kuna\Ares; /** @var Ares\Ares $ares */ $result = $ares->getAresClient()->searchEndpoint(Ares\Ares\Sources::DIAL, [ 'kodCiselniku' => 'PravniForma', 'zdrojCiselniku' => 'res', ])->ciselniky[0]->polozkyCiselniku; foreach ($result as $item) { var_dump($item); }
Data Box (datová schránka)
use h4kuna\Ares; /** @var Ares\Ares $ares */ try { // returns a list of data boxes of the subject foreach ($ares->loadDataBox('87744473') as $dataBox) { var_dump($dataBox->ISDS); } } catch (Ares\Exception\ResultException | Ares\Exception\ServerResponseException $e) { // catch error }
VIES
Supports the basic VAT number check. The VAT number must start with the country code, or pass an instance of Ares\Vies\ViesEntity.
use h4kuna\Ares; /** @var Ares\Ares $ares */ try { $response = $ares->checkVatVies('CZ27082440'); var_dump($response->valid); // true / false } catch (Ares\Exception\ServerResponseException $e) { // service error, for example MS_UNAVAILABLE }
