定制 sigrun/ceidg-api 二次开发

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

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

sigrun/ceidg-api

Composer 安装命令:

composer require sigrun/ceidg-api

包简介

PHP CEIDG API library

README 文档

README

Build Status Coverage Status StyleCI Maintainability

PHP CEIDG API library

We proudly present a PHP library to connect with CEIDG (Polish registry on businesses) API, using SOAP protocol.

Our library is capable of parsing querying result into well-formatted object or array of objects, validating inputted data (such as VAT number). Build atop the SOLID, DRY, and KISS principles, it provides a comprehensive tool to communicate with CEIDG API.

Please refer to the official API documentation, available at the CEIDG system website at https://datastore.ceidg.gov.pl (you should be logged in to view documentation files). Our library reflects their idea wholly.

Usage

Installation

As simple as it can be:

composer require sigrun/ceidg-api

Declaring API client

To declare API client, create new client class, with authorization token and (optionally) sandbox flag as arguments:

use CeidgApi\CeidgApi;

$authToken = 'secret';

// To connect with the production environment
$ceidgProductionApi = new CeidgApi($authToken);

// To connect with the sandbox environment
$ceidgSandboxApi = new CeidgApi($authToken, true);

Declaring requested function

CEIDG API provides two SOAP functions - GetId and GetMigrationData201901. The first returns only companies' unique IDs, whereas the second one - full data on the companies.

$getId = $ceidgProductionApi->getId();

$getMigrationData = $ceidgProductionApi->getMigrationData();
// or
$getMigrationData = $ceidgProductionApi->getMigrationData201901();

Setting query parameters with a simple chain of responsibility pattern

We've implemented a simple chain of responsibility pattern, enabling easy setting up querying params.

// To get IDs of all companies modified or created on August 5th, 2019
$result = $getId->setMigrationDateFrom('2019-08-05')->setMigrationDateTo('2019-08-05')->send();

// To get IDs of all companies having postcode '02-662'
$result = $getId->setPostcode('02-662')->send();

Parsing of response

You can demand on-the-fly parsing of the result. Depending on the number of retrieved entries, you will receive either a single object or an array of them. send() method has a $parse argument, default set to true.

An example (abbreviated) of parsed response looks as following:

{
  "IdentyfikatorWpisu": "ff83fff2fc2ab947f78fb6069f1767df",
  "DanePodstawowe": {
    "Imie": "Ryszard",
    "Nazwisko": "Petru",
    "NIP": "8991999655",
    "REGON": "147022306",
    "Firma": "Ryszard Petru Consulting"
  }
}

Single line of code

You can do everything mentioned above, within a single line of code:

$result = (new CeidgApi($authToken))->getId()->setMigrationDateFrom('2019-08-05')->setMigrationDateTo('2019-08-05')->send();

Available params

Available query params are compliant with those described in the official API documentation. A 'UniqueId' param can be set using the 'setUniqueId' method, a 'NIP' param - using the 'setNIP' method, etc.

Removing param from query

To remove a param from query params array, you can call a method with 'null' as its only argument, like 'SetUniqueId(null)'. There's no difference between method names starting with a capital letter or not.

GetMigrationData

Param Query functions Setter method Type Has validator?
DateTo GetId, GetMigrationData SetDateTo String ('Y-m-d') not yet
DateFrom GetId, GetMigrationData SetDateFrom String ('Y-m-d') not yet
MigrationDateTo GetId, GetMigrationData SetMigrationDateTo String ('Y-m-d') not yet
MigrationDateFrom GetId, GetMigrationData SetMigrationDateFrom String ('Y-m-d') not yet
UniqueId GetMigrationData SetUniqueId Array of strings not yet
NIP GetMigrationData SetNIP Array of strings yes
REGON GetMigrationData SetREGON Array of strings yes
NIP_SC GetMigrationData SetNIP_SC Array of strings yes
REGON_SC GetMigrationData SetREGON_SC Array of strings yes
Name GetMigrationData SetName Array of strings no
Province GetMigrationData SetProvince Array of strings no
County GetMigrationData SetCounty Array of strings no
Commune GetMigrationData SetCommune Array of strings no
City GetMigrationData SetCity Array of strings no
Street GetMigrationData SetStreet Array of strings no
Postcode GetMigrationData SetPostcode Array of strings yes
PKD GetMigrationData SetPKD Array of strings yes
Status GetMigrationData SetStatus Array of integers within [1,2,3,4,9] yes

When a SOAP request envelope is sent, all previously set params are cleared.

sigrun/ceidg-api 适用场景与选型建议

sigrun/ceidg-api 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 8.96k 次下载、GitHub Stars 达 10, 最近一次更新时间为 2019 年 08 月 22 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 sigrun/ceidg-api 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 sigrun/ceidg-api 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

  • Stars: 10
  • Watchers: 1
  • Forks: 5
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-08-22