kbo-public-search-for-laravel maintained by masmerise
Laravel adapter for the KBO Public Search SDK
This package provides convenient access to the KBO Public Search SDK using the Laravel framework.
Installation
You can install the package via composer:
composer require masmerise/kbo-public-search-for-laravel
After that, define your kbo credentials inside the config/services.php configuration file:
'kbo' => [
'username' => env('KBO_USERNAME'),
'password' => env('KBO_PASSWORD'),
'env' => env('KBO_ENV', 'production'), // or 'test'
],
Set env to test to send requests to the KBO acceptance environment instead of production. Each environment has its own credentials.
Usage
use KboPublicSearch\Core\Type\Primitive\EnterpriseNumber;
$enterprise = kbo()->enterprises->find(EnterpriseNumber::fromString('0314.595.348'))->enterprise;
$kbo = app('kbo');
$codes = $kbo->codeLists->authorizationSearchCodes()->authorizationSearchCodes;
use KboPublicSearch\Core\Type\Primitive\EnterpriseNumber;
use KboPublicSearch\KboPublicSearch;
final readonly class EnterpriseController
{
public function __construct(private KboPublicSearch $kbo) {}
public function show(string $number): View
{
$number = EnterpriseNumber::fromString($number);
return view('enterprise.show', [
'enterprise' => $this->kbo->enterprises->find($number)->enterprise,
]);
}
}
Localization
Descriptions follow the application locale: fr returns French descriptions, any other locale returns Dutch, since KBO
only serves those two. Changing the locale at runtime (App::setLocale()) updates the resolved instance as well.
Testing
composer test
Changelog
Please see CHANGELOG for more information on what has changed recently.
Security
If you discover any security related issues, please email support@masmerise.be instead of using the issue tracker.
Credits
License
The MIT License (MIT). Please see License File for more information.