h4kuna/ares
Composer 安装命令:
composer require h4kuna/ares
包简介
Provides information about subjects by their identification number from the ARES database (in Czech Republic).
README 文档
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\Exception\IdentificationNumberNotFoundException $e) { // log identification number, why is bad? Or make nothing. } catch (Ares\Exception\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\Exception\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\Exception\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\Exception\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\Exception\ServerResponseException $e) { // invalid VAT }
h4kuna/ares 适用场景与选型建议
h4kuna/ares 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 420.51k 次下载、GitHub Stars 达 50, 最近一次更新时间为 2012 年 12 月 09 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 h4kuna/ares 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 h4kuna/ares 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 420.51k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 50
- 点击次数: 36
- 依赖项目数: 2
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2012-12-09
