A Laravel package for fetching basic data from Brønnøysundregisteret (the Norwegian Register of Business Enterprises). Supports both Enhetsregisteret and Frivillighetsregisteret.
- PHP 8.2 or higher
- Laravel 11 or 12
You can install the package via composer:
composer require tor2r/laravel-brreg-apiYou can publish the config file with:
php artisan vendor:publish --tag="brreg-api-config"This is the contents of the published config file:
return [
'base_url' => env('BRREG_API_BASE_URL', 'https://data.brreg.no'),
'results_per_page' => env('BRREG_API_RESULTS_PER_PAGE', 100),
];use Tor2r\BrregApi\Facades\BrregApi;
// Fetch a single entity by organisation number
$entity = BrregApi::getByOrgnr('987654321');
// Search by name
$results = BrregApi::searchByName('Sesam');
// Limit the number of results
$results = BrregApi::searchByName('Sesam', 10);// Fetch a single voluntary organisation
$org = BrregApi::voluntary()->getByOrgnr('987654321');
// Search voluntary organisations by name
$results = BrregApi::voluntary()->searchByName('Frivillig');Single entity (getByOrgnr) returns a flat array with the entity data:
$entity = BrregApi::getByOrgnr('925183873');
// [
// 'organisasjonsnummer' => '925183873',
// 'navn' => 'FAGFOKUS AS',
// 'organisasjonsform' => [...],
// 'forretningsadresse' => [...],
// 'antallAnsatte' => 7,
// ...
// ]Search methods (searchByName) return a structured response with data and meta:
$results = BrregApi::searchByName('Fagfokus');
// [
// 'data' => [
// [
// 'organisasjonsnummer' => '925183873',
// 'navn' => 'FAGFOKUS AS',
// 'antallAnsatte' => 7,
// ...
// ],
// ],
// 'meta' => [
// 'per_page' => 100,
// 'total' => 1,
// 'total_pages' => 1,
// 'current_page' => 0,
// ],
// ]Internal API fields (_links, respons_klasse) are automatically stripped from responses.
The package throws Tor2r\BrregApi\Exceptions\BrregApiException when something goes wrong:
use Tor2r\BrregApi\Exceptions\BrregApiException;
try {
$entity = BrregApi::getByOrgnr('000000000');
} catch (BrregApiException $e) {
// "No entity found with organisation number: 000000000"
echo $e->getMessage();
}composer testPlease see CHANGELOG for more information on what has changed recently.
The MIT License (MIT). Please see License File for more information.