halloverden / symfony-brreg-http-client
Provides a Symfony http client for the brreg (Brønnøysundregistrene) api
1.2.0
2022-11-07 15:27 UTC
Requires
- php: >=8.1
- doctrine/collections: ^1.6
- halloverden/symfony-http-exceptions: ^2.0
- jms/serializer-bundle: ^3.10|^4.2|^5.0
- symfony/http-client: ^5.4|^6.1
Requires (Dev)
- symfony/validator: ^5.4|^6.1
README
Symfony Http Client for the Open Brreg REST Api for the Organization Registry.
Installation
Via composer:
$ composer require halloverden/symfony-brreg-http-client
Usage
In your services.yaml
, set
HalloVerden\BrregHttpClient\Interfaces\BrregServiceInterface: class: HalloVerden\BrregHttpClient\Services\BrregService
In your class, inject the BrregServiceInterface
class:
class TestService {
/**
* @var BrregServiceInterface
*/
private $service;
public function __construct(BrregServiceInterface $service) {
$this->service = $service;
}
/**
* @param int $organizationNumber
* @param $fetchParentsIfPresent
*
* @return Organization
*/
public function test(int $organizationNumber, $fetchParentsIfPresent): Organization {
return $this->service->findOrganizationByOrganizationNumber($organizationNumber, $fetchParentsIfPresent);
}
}
Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.