Skip to main content

KVK

The KVK module provides Dutch Chamber of Commerce search through KvkCompanyField and KvkService.

Use it when a form should search company data and copy the selected result into normal Qore fields.

Install

composer require qore-next/kvk

The package auto-discovers KvkServiceProvider.

No migrations, config or routes are published by this module. Install it, enable it in the modules UI and configure the API key before using the field in production.

Usage

use Qore\Next\Kvk\Fields\KvkCompanyField;
use Qore\Next\Kvk\Results\KvkCompanyResult;

KvkCompanyField::make('company')
->onCompanySelected(function (KvkCompanyResult $company, Form $form) {
$form->setFieldValue('name', $company->name);
$form->setFieldValue('kvk_number', $company->kvkNumber);
});

The field searches as the user types and stores the selected company in node state so the backend callback can copy company data into other fields.

Register the frontend module in resources/js/app.tsx so the KvkCompany field component and translations are available:

import kvkModule from '../../vendor/qore-next/kvk/resources/js'

<QoreAppProvider
app={{
// ...
modules: [kvkModule]
}}
/>

Configure

Enable the module in Qore's modules UI, then save the KVK API key in the module settings.

The key is stored as:

qore()->settings()->getSetting('kvk.api_key');

The settings form validates the key against the KVK search endpoint.