rikukukkaniemi/finnish-company-info 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

rikukukkaniemi/finnish-company-info

最新稳定版本:v1.1.0

Composer 安装命令:

composer require rikukukkaniemi/finnish-company-info

包简介

Get Finnish company information using business ID (y-tunnus)

README 文档

README

With this PHP library you can easily fetch data on a company given its business ID (y-tunnus):

  • Name of the company
  • Website
  • Current address (street, city, postal code)
  • Current main line of business (code and textual description)

Library uses https://avoindata.prh.fi/ytj_en.html as the data source.

Installation

You can require library with:

composer require rikukukkaniemi/finnish-company-info

See requirements from Packagist.

How to use

Here is an example on how to use the library:

public function example(CompanyInfoService $companyInfoService): void
{
    try {
        $companyInfo = $companyInfoService->getCompanyInformation('1234567-8');
    } catch (CompanyInfoException) {
        // Handle exception
        return;
    }

    $companyInfo->getName();                                // String
    $companyInfo->getWebsite();                             // String or null

    $currentAddress = $companyInfo->getCurrentAddress();    // Address object
    $currentAddress->getStreet();                           // String
    $currentAddress->getCity();                             // String
    $currentAddress->getPostalCode();                       // String

    $businessLines = $companyInfo->getBusinessLines();      // Array of BusinessLine objects (can be empty)
    $businessLines[0]->getCode();                           // String
    $businessLines[0]->getDescription();                    // String
    $businessLines[0]->getLanguage();                       // String (language of description)
}

Note that CompanyInfoException is the parent exception. You can also catch a more specific cases of exceptions:

  • InvalidBusinessIdException when business ID seems to be invalid.
  • CompanyNotFoundException when company is not found for given business ID.
  • UnexpectedClientDataException when the data source returns unexpected data. Should not occur unless data source is broken.

The example code can also be found here.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-05-07