Created
March 2, 2022 12:20
-
-
Save HelgeSverre/871c002333a23e1bc391f21c0bad8834 to your computer and use it in GitHub Desktop.
Laravel Brønnøysundregistrene - Brreg
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Illuminate\Support\Facades\Http; | |
class Brreg | |
{ | |
public function getByVatId($vatId) | |
{ | |
return Http::get("https://data.brreg.no/enhetsregisteret/api/enheter/$vatId")->json(); | |
} | |
public function getRoles($vatId) | |
{ | |
return Http::get("https://data.brreg.no/enhetsregisteret/api/enheter/$vatId/roller")->json(); | |
} | |
public function searchByName($name, $params = []) | |
{ | |
return Http::get("https://data.brreg.no/enhetsregisteret/api/enheter", | |
array_merge(["navn" => $name], $params) | |
)->json(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You don't need a SDK or a wrapper for this stuff if you are doing this for the ability to autocomplete a "company form" (which, let's be serious, covers probably 80% of the people landing on this gist via search)
If you want to make it more fancy, you can wrap everything in DTOs, add a Fluent Builder class for parameters etc.
Hjelper gjerne nybegynnere i kommentarfeltet