mantix/kvk-api 问题修复 & 功能扩展

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

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

mantix/kvk-api

最新稳定版本:v1.4

Composer 安装命令:

composer require mantix/kvk-api

包简介

KvK API client (Dutch Chamber of Commerce API)

README 文档

README

Latest Version on Packagist Tests Total Downloads

A robust PHP package for interacting with the Dutch Chamber of Commerce (KvK) API. This package is a fork of vormkracht10/kvk-api with additional features and improvements.

Features

  • Search companies by name, KvK number, RSIN, or establishment number
  • Fetch detailed company profiles
  • Built-in caching to minimize API calls
  • Rate limiting to respect API guidelines
  • Comprehensive error handling
  • PSR-7 compliant

Data Available

For each company, you can retrieve:

  • KvK number
  • Establishment number
  • Trade name(s)
  • Address(es) including:
    • Type
    • Full address
    • Street
    • House number
    • Postal code
    • City
    • Country
  • Website(s)
  • Basic profile information (new)

Installation

Install the package via Composer:

composer require mantix/kvk-api

Required dependencies:

composer require illuminate/support
composer require psr/http-message
composer require guzzlehttp/guzzle

Getting Started

First, obtain your API key from the KvK Developer Portal.

use Mantix\KvkApi\ClientFactory;

$apiKey = '<YOUR_KVK_API_KEY>';
$kvk = ClientFactory::create($apiKey);

Basic Company Search

// Search by company name
$companies = $kvk->search('Mantix');

// Search with pagination
$kvk->setPage(1)
    ->setResultsPerPage(10);
$companies = $kvk->search('Mantix');

Specific Searches

// By KvK number
$companies = $kvk->searchByKvkNumber('12345678');

// By RSIN
$companies = $kvk->searchByRsin('123456789');

// By establishment number
$companies = $kvk->searchByVestigingsnummer('000012345678');

Get Company Profile

// Fetch detailed company profile
$profile = $kvk->getBaseProfile('12345678');

Advanced Usage

// Search with additional parameters
$companies = $kvk->search('Mantix', [
    'pagina' => 1,
    'resultatenPerPagina' => 10,
    // Add any other API parameters
]);

// Using SSL certificate
$rootCertificate = '<PATH_TO_SSL_CERT>';
$kvk = ClientFactory::create($apiKey, $rootCertificate);

Error Handling

The package includes comprehensive error handling:

use Mantix\KvkApi\Exceptions\KvkApiException;

try {
    $companies = $kvk->search('Mantix');
} catch (KvkApiException $e) {
    // Handle API-specific errors
    echo $e->getMessage();
} catch (\Exception $e) {
    // Handle general errors
    echo $e->getMessage();
}

Testing

composer test

Documentation

Contributing

Contributions are welcome! Please see CONTRIBUTING for details.

Credits

License

The MIT License (MIT). Please see License File for more information.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-01-14