Download the PHP package dij-digital/kvk-laravel without Composer
On this page you can find all versions of the php package dij-digital/kvk-laravel. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package kvk-laravel
KVK Laravel
A Laravel package for the Dutch KVK (Kamer van Koophandel) Handelsregister API. Provides a clean, typed, and fakable interface for searching the company registry.
Requirements
- PHP ^8.4|^8.5
- Laravel ^12
Installation
The service provider and facade are auto-discovered.
Publish the config file:
Configuration
Add your API key to .env:
For testing against the KVK sandbox, use:
Usage
Search
Search the KVK registry using the fluent API:
Or pass a SearchParameters DTO directly:
Both approaches produce identical API calls.
Available search parameters
| Method | Type | Description |
|---|---|---|
kvkNumber(string) |
string | 8-digit KVK number |
rsin(string) |
string | 9-digit RSIN number |
branchNumber(string) |
string | 12-digit branch number |
name(string) |
string | Trade name or statutory name |
streetName(string) |
string | Street name |
city(string) |
string | City name |
postalCode(string) |
string | Postal code (with houseNumber or poBoxNumber) |
houseNumber(int) |
int | House number (with postalCode) |
houseLetter(string) |
string | House letter (with houseNumber) |
poBoxNumber(int) |
int | PO box number (with postalCode) |
type(array) |
array | Filter: hoofdvestiging, nevenvestiging, rechtspersoon |
includeInactiveRegistrations(bool) |
bool | Include dissolved companies (default: false) |
page(int) |
int | Page number (default: 1) |
resultsPerPage(int) |
int | Results per page (default: 100, max: 100) |
Base Profile
Retrieve detailed company information by KVK number using the fluent API:
Available base profile options
| Method | Description |
|---|---|
get() |
Main company profile — name, registration dates, trade names, SBI activities |
owner() |
Owner information — legal form, addresses, websites |
mainBranch() |
Main branch details — employees, addresses, trade names, SBI activities |
branches() |
All branches listing — counts and summary per branch |
geoData(bool) |
Include GPS coordinates in address responses (default: false) |
Branch Profile
Retrieve detailed branch information by branch number (vestigingsnummer):
Available branch profile options
| Method | Description |
|---|---|
get() |
Branch profile — trade names, employees, addresses, websites, and SBI activities |
geoData(bool) |
Include GPS coordinates in address responses (default: false) |
Naming (Trade Names)
Retrieve trade names by KVK number:
Available naming options
| Method | Description |
|---|---|
get() |
Trade names profile — statutory name, primary name, aliases, and branch-level names |
Subscriptions (Mutatieservice)
Monitor changes to KVK registry entries via the Mutatieservice (change notifications):
Available subscription options
| Method | Description |
|---|---|
get() |
List all subscriptions for your API key |
subscription(string) |
Scope to a specific subscription (returns a scoped builder) |
Available signal options (on scoped subscription)
| Method | Description |
|---|---|
from(string) |
Filter signals from this ISO 8601 datetime |
to(string) |
Filter signals until this ISO 8601 datetime |
page(int) |
Page number (default: 1) |
resultsPerPage(int) |
Results per page (min: 10, max: 500, default: 100) |
signals() |
List signals for this subscription (paginated) |
signal(string) |
Get a specific signal's full details |
Error Handling
The package throws typed exceptions for API failures. All exceptions extend KvkException and expose statusCode and responseBody properties.
| Exception | When |
|---|---|
KvkAuthenticationException |
HTTP 401 or 403 — invalid or missing API key |
KvkServerException |
HTTP 500+ — KVK API server error |
KvkRequestException |
Any other non-successful HTTP response |
Testing
The package is designed to be easily fakeable in your application tests.
Basic Usage
Use KVK::fake() to replace all KVK API calls with a fake that returns no results:
Faking Specific Responses
Pass response DTOs to KVK::fake() using named parameters to control what each endpoint returns:
Available fake() parameters
| Parameter | Type | Description |
|---|---|---|
$baseProfile |
?BaseProfileResponse |
Custom base profile response |
$baseProfileOwner |
?BaseProfileOwnerResponse |
Custom owner response |
$baseProfileMainBranch |
?BaseProfileMainBranchResponse |
Custom main branch response |
$baseProfileBranches |
?BaseProfileBranchesResult |
Custom branches result |
$branchProfile |
?BranchProfileResponse |
Custom branch profile response |
$naming |
?NamingResponse |
Custom naming response |
$subscriptions |
?SubscriptionsResult |
Custom subscriptions result |
$signals |
?SignalsResult |
Custom signals result |
$signal |
?SignalResponse |
Custom signal response |
...$searchResponses |
SearchResponse |
Search responses — pass via withSearchResponses() on the returned FakeKVK |
Fluent Builder Interface
You can also update a fake after it's been created using the fluent with* methods:
DTO Fake Defaults
Every response DTO provides a fake() method with sensible defaults from the KVK test environment. Only specify the fields you need to override:
| Parameter | Default |
|---|---|
kvkNumber |
'69599068' |
name |
'Test BV Donald' |
type |
'hoofdvestiging' |
active |
'Ja' |
branchNumber |
'000037178598' |
rsin |
null |
address |
null |
Facade Cleanup
If you use KVK::fake() in tests that extend Laravel's TestCase, cleanup is automatic. For plain PHPUnit tests, add this to your test class:
Advanced: HTTP-Level Faking
For lower-level tests that need to verify the full HTTP pipeline (including request parameters and response parsing), you can still use Http::fake() directly:
License
MIT
All versions of kvk-laravel with dependencies
illuminate/http Version ^12 || ^13
illuminate/support Version ^12 || ^13