h4kuna / ares
Provides information about subjects by their identification number from the ARES database (in Czech Republic).
Fund package maintenance!
h4kuna
revolut.me/milan2m/czk1000/ares
Installs: 298 964
Dependents: 1
Suggesters: 0
Security: 0
Stars: 47
Watchers: 8
Forks: 16
Open Issues: 0
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: ^1.8
- phpstan/phpstan-strict-rules: ^1.4
- tracy/tracy: ^2.9
Suggests
- guzzlehttp/guzzle: As default implementation for PSR-7, PSR-17 and PSR-18 standards.
- dev-master
- 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-address-fallback
This package is auto-updated.
Last update: 2024-09-30 17:17:11 UTC
README
More information about versions is in changelog.
Support development by QR code
Use QR code or sponsor button where is link on my revolut.
Thank you :)
Installation to project
The best way to install h4kuna/ares is using Composer:
composer require h4kuna/ares
# optional and default support
composer require guzzlehttp/guzzle
Download information about customer via his IN.
ARES
Homepage documentation for developers.
Load data by one identification number.
use h4kuna\Ares; $ares = (new Ares\AresFactory())->create(); try { $response = $ares->loadBasic('87744473'); /* @var $response Ares\Ares\Core\Data */ var_dump($response); } catch (Ares\Exceptions\IdentificationNumberNotFoundException $e) { // log identification number, why is bad? Or make nothing. } catch (Ares\Exceptions\AdisResponseException $e) { // if validation by adis failed, but data from ares returned /* @var $response Ares\Ares\Core\Data */ $response = $e->data; $response->adis === null; // true var_dump($e->getMessage()); } catch (Ares\Exceptions\ServerResponseException $e) { // no response from server or broken json }
Load data by many identification numbers. Limit by ARES service is set to 100 items, but library chunk it and check duplicity.
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\Exceptions\ServerResponseException $e) { // no response from server or broken json }
Other endpoints
Choose endpoint from class Sources.
- SERVICE_* - available other endpoints
- CORE - is main endpoint this is used in method
$ares->loadBasic()
- DIAL - use if you want list of value for example
PravniForma
- SER_NO_* are not exists
use h4kuna\Ares; /** @var Ares\Ares $ares */ $result = $ares->getAresClient()->useEndpoint(Ares\Ares\Sources::SERVICE_VR, '27082440'); var_dump($result);
Dials
Parameters kodCiselniku
and zdrojCiselniku
you can find in json file, on this page AresRestApi-verejne_v*.json, like a 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á schánka)
use h4kuna\Ares; /** @var Ares\Ares $ares */ try { $response = $ares->loadDataBox('87744473'); var_dump($response->ISDS); } catch (h4kuna\Ares\Exceptions\ServerResponseException $e) { // catch error }
VIES
Support base check.
use h4kuna\Ares; /** @var Ares\Ares $ares */ try { $response = $ares->checkVatVies($vatNumber); var_dump($response->valid); // true / false } catch (Ares\Exceptions\ServerResponseException $e) { // invalid VAT }