sj_royd/regon_api
Composer 安装命令:
composer create-project sj_royd/regon_api
包简介
API GUS REGON
关键字:
README 文档
README
The BIR1.1 (Baza Internetowa REGON v1.1) API (https://wyszukiwarkaregon.stat.gov.pl/appBIR/index.aspx).
Installation
The API client can be installed via Composer.
In your composer.json file:
{
"require": {
"sj_royd/regon_api": "~1.0"
}
}
or using a command line
composer require sj_royd/regon_api
Basic Usage
Default dates format
Default data dates format is yyyy-mm-dd.
It is possible to change the dates format:
<?php
require_once 'vendor/autoload.php';
use \SJRoyd\GUS\RegonApi\Date;
Date::setFormat('d.m.Y'); // format dd.mm.yyyy
Login
Test mode
<?php
require_once 'vendor/autoload.php';
use SJRoyd\GUS\RegonApi\Exception\KeyMissingException;
use SJRoyd\GUS\RegonApi\BIRService;
$userKey = null; // In the test mode any key is accepted
$api = new BIRService(true);
try {
$api->login($userKey);
} catch (KeyMissingException $e) {
}
Production mode
<?php
require_once 'vendor/autoload.php';
use SJRoyd\GUS\RegonApi\BIRService;
$userKey = 'my-unique-key'; // User key obtained from the GUS
$api = new BIRService();
$api->login($userKey);
Search units
<?php
use SJRoyd\GUS\RegonApi\Enum\SearchType;
use SJRoyd\GUS\RegonApi\Exception\InvalidSearchTypeException;
use SJRoyd\GUS\RegonApi\Exception\NotFoundException;
use SJRoyd\GUS\RegonApi\Exception\NumberMissingException;
use SJRoyd\GUS\RegonApi\Exception\TooManyNumbersException;
try {
$searchBy = SearchType::NIP;
$searchNumber = '5261040828'
$units = $api->search($searchBy, $searchNumber);
} catch (InvalidSearchTypeException $e) {
} catch (NotFoundException $e) {
} catch (NumberMissingException $e) {
} catch (TooManyNumbersException $e) {
}
Search types
SearchType::NIPnumber param as a stringSearchType::NIPSnumbers param as an array of strings or string separated by new line, space, dot, coma or semicolonSearchType::REGONnumber param as a stringSearchType::REGONSnumbers param as an array of strings or string (...)SearchType::KRSnumber param as a stringSearchType::KRSESnumbers param as an array of strings or string (...)SearchType::REGONS9numbers param as an array of strings or string (...)SearchType::REGONS14numbers param as an array of strings or string (...)
Reports
<?php
use SJRoyd\GUS\RegonApi\Enum\ReportType;
use SJRoyd\GUS\RegonApi\Exception\CivilLawPartnershipException;
use SJRoyd\GUS\RegonApi\Exception\NotFoundException;
use SJRoyd\GUS\RegonApi\Exception\PkdException;
use SJRoyd\GUS\RegonApi\Exception\ReportException;
$regon = '';
$reportType = ReportType::PHYSIC_GENERAL;
try {
$api->getFullReport($regon, $reportType);
} catch (CivilLawPartnershipException $e) {
} catch (NotFoundException $e) {
} catch (PkdException $e) {
} catch (ReportException $e) {
}
List of report types
| $unit type | $unit silodId | report type | desc |
|---|---|---|---|
| F | 1/2/3 | ReportType::PHYSIC_GENERAL | Data of a natural person common to all their activities. |
| F | 1 | ReportType::PHYSIC_CEIDG | Data on the activities registered in the CEIDG, including the address of this activity. |
| F | 2 | ReportType::PHYSIC_AGRICULTURAL | Data on agricultural activities; including agricultural business address. |
| F | 3 | ReportType::PHYSIC_OTHER | Data on activities other than CEIDG and agricultural (bailiff, notary, agrotourism) including business address. |
| F | 4 | ReportType::PHYSIC_DELETED | Data on operations deleted from REGON before 11.11.2014 (i.e. in the previous IT system). |
| F | 1/2/3 | ReportType::PHYSIC_PKD | List of PKD codes for the entity of a natural person |
| F | 1/2/3 | ReportType::PHYSIC_LOCALS_LIST | List of local units (e.g. company branches) registered for the entity of a natural person |
| F | 1/2/3 | ReportType::PHYSIC_LOCAL (14-digits REGON) | Data of the local unit of the entity of a natural person |
| F | 1/2/3 | ReportType::PHYSIC_LOCAL_PKD (14-digits REGON) | List of PKD codes for the local unit of a natural person |
| P | ReportType::LAW | Legal entity data; Note: Reports for a legal entity also regarding a civil law partnership which is not a legal entity. | |
| P | ReportType::LAW_PKD | List of PKD codes for the entity of a legal person | |
| P | ReportType::LAW_LOCALS_LIST | List of local units (e.g. company branches) registered for a legal entity | |
| LP | ReportType::LAW_LOCAL (14-digits REGON) | Data of the local unit of the entity of the legal person | |
| LP | ReportType::LAW_LOCAL_PKD (14-digits REGON) | List of PKD codes for the local unit of the entity of a legal person | |
| P | ReportType::LAW_SC_COLLABORATORS | List of partners in a civil law partnership (only S.C.) Note: REGON has been registering partners since 2012. (For companies established before 2012 and not updated - there is no data in REGON about partners). |
Note: Not every law unit is a SC (civil law partnership) and this report can throws the CivilLawPartnershipException.
Automatically get relevant reports for a specific unit
<?php
use SJRoyd\GUS\RegonApi\Exception\NotFoundException;
use SJRoyd\GUS\RegonApi\Exception\PkdException;
use SJRoyd\GUS\RegonApi\Exception\ReportException;
try {
foreach($units as $unit){
$unit->getReports();
}
} catch (NotFoundException $e) {
} catch (PkdException $e) {
} catch (ReportException $e) {
}
Every reports will save to the reports property of the unit in.
| $unit type | $unit silosId | reports |
|---|---|---|
| F | 1 | general, ceidg, pkd, locals |
| F | 2 | general, agricultural, pkd, locals |
| F | 3 | general, other, pkd, locals |
| F | 4 | deleted |
| LF | 1/2/3 | general, pkd |
| P | general, pkd, locals, collaborators | |
| LP | general, pkd |
GetValue
<?php
use SJRoyd\GUS\RegonApi\Enum\Value;
$value = $api->getValue(Value::SERVICE_STATUS);
$value->getMessage();
sj_royd/regon_api 适用场景与选型建议
sj_royd/regon_api 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 14 次下载、GitHub Stars 达 0, 最近一次更新时间为 2020 年 04 月 07 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「framework」 「laravel」 「lumen」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 sj_royd/regon_api 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 sj_royd/regon_api 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 sj_royd/regon_api 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
PHP Framework HLEB2 is the foundation of the web application. Provides ease of development and application performance.
Testing Suite For Lumen like Laravel does.
Stackdriver handler for Monolog (codeinternetapplications/monolog-stackdriver Fork).
Class to generate a standard structure for api json responses
Amqp classes
Audit changes of your Eloquent models in Laravel/Lumen
统计信息
- 总下载量: 14
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-04-07