定制 sj_royd/regon_api 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

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::NIP number param as a string
  • SearchType::NIPS numbers param as an array of strings or string separated by new line, space, dot, coma or semicolon
  • SearchType::REGON number param as a string
  • SearchType::REGONS numbers param as an array of strings or string (...)
  • SearchType::KRS number param as a string
  • SearchType::KRSES numbers param as an array of strings or string (...)
  • SearchType::REGONS9 numbers param as an array of strings or string (...)
  • SearchType::REGONS14 numbers 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 typedesc
F1/2/3ReportType::PHYSIC_GENERALData of a natural person common to all their activities.
F1ReportType::PHYSIC_CEIDGData on the activities registered in the CEIDG, including the address of this activity.
F2ReportType::PHYSIC_AGRICULTURALData on agricultural activities; including agricultural business address.
F3ReportType::PHYSIC_OTHERData on activities other than CEIDG and agricultural (bailiff, notary, agrotourism) including business address.
F4ReportType::PHYSIC_DELETEDData on operations deleted from REGON before 11.11.2014 (i.e. in the previous IT system).
F1/2/3ReportType::PHYSIC_PKDList of PKD codes for the entity of a natural person
F1/2/3ReportType::PHYSIC_LOCALS_LISTList of local units (e.g. company branches) registered for the entity of a natural person
F1/2/3ReportType::PHYSIC_LOCAL (14-digits REGON)Data of the local unit of the entity of a natural person
F1/2/3ReportType::PHYSIC_LOCAL_PKD (14-digits REGON)List of PKD codes for the local unit of a natural person
PReportType::LAWLegal entity data; Note: Reports for a legal entity also regarding a civil law partnership which is not a legal entity.
PReportType::LAW_PKDList of PKD codes for the entity of a legal person
PReportType::LAW_LOCALS_LISTList of local units (e.g. company branches) registered for a legal entity
LPReportType::LAW_LOCAL (14-digits REGON)Data of the local unit of the entity of the legal person
LPReportType::LAW_LOCAL_PKD (14-digits REGON)List of PKD codes for the local unit of the entity of a legal person
PReportType::LAW_SC_COLLABORATORSList 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
F1general, ceidg, pkd, locals
F2general, agricultural, pkd, locals
F3general, other, pkd, locals
F4deleted
LF1/2/3general, pkd
Pgeneral, pkd, locals, collaborators
LPgeneral, 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 我们能提供哪些服务?
定制开发 / 二次开发

基于 sj_royd/regon_api 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 14
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-04-07