定制 ivuorinen/business-data-fetcher 二次开发

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

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

ivuorinen/business-data-fetcher

最新稳定版本:v1.1.1

Composer 安装命令:

composer require ivuorinen/business-data-fetcher

包简介

Library to fetch finnish business data

README 文档

README

PHP Composer

PHP library for fetching Finnish business data from the PRH (Finnish Patent and Registration Office) open data API.

Supports both v1 (BIS) and v3 (YTJ) APIs.

Installation

composer require ivuorinen/business-data-fetcher

Usage

v1 API (BIS)

Fetch company details by Business ID:

use Ivuorinen\BusinessDataFetcher\BusinessDataFetcher;

$client = new BusinessDataFetcher();
$results = $client->getBusinessInformation('1639413-9');

foreach ($results as $company) {
    echo $company->name . "\n";
    echo $company->businessId . "\n";

    foreach ($company->names as $name) {
        echo $name->name . ' (' . $name->getLanguageString() . ")\n";
    }
}

v3 API (YTJ)

Search companies with multiple filters:

use Ivuorinen\BusinessDataFetcher\v3\Client;

$client = new Client();

// Search by name
$result = $client->searchCompanies(name: 'Example');
echo "Found {$result->totalResults} companies\n";

foreach ($result->companies as $company) {
    echo $company->businessId->value . ' - ';
    echo $company->names[0]->name . "\n";
}

// Search by Business ID
$result = $client->searchCompanies(businessId: '1639413-9');

// Search with multiple filters
$result = $client->searchCompanies(
    location: 'Helsinki',
    companyForm: 'OY',
    mainBusinessLine: '62010',
);

// Get code list descriptions
$description = $client->getDescription('REK', 'en');

// Get postal codes
$postCodes = $client->getPostCodes('fi');

// Download all companies as ZIP
$stream = $client->getAllCompanies();
file_put_contents('companies.zip', $stream->getContents());

v1 vs v3 API Comparison

Feature v1 (BIS) v3 (YTJ)
Base URL /bis/v1 /opendata-ytj-api/v3
Lookup By Business ID only Search by name, location, form, etc.
Company form String code Structured with descriptions
Addresses Flat structure Nested with PostOffice objects
Code lists N/A /description endpoint
Postal codes N/A /post_codes endpoint
Bulk download N/A /all_companies ZIP

Migration from v1 DTOs

If upgrading from the Spatie DTO version:

  • DTOs are now final readonly classes (no ->toArray())
  • $sourceText / $authorityText properties removed; use getSourceText() / getAuthorityString() methods
  • HasVersion trait removed; $version is a regular constructor property
  • BusinessDataFetcher constructor accepts an optional Guzzle Client for testing

Development

composer lint          # PSR-12 linting
composer lint-fix      # Auto-fix violations
composer phpstan       # Static analysis (level 9)
composer test          # Pest test suite

Data Source

Notice of Liability

The data provided by the API is subject to change without warning and the author(s) of this library are providing this without compensation and cannot be held responsible.

License

MIT licensed

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-08-13

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固