Retrieves company and establishment data from the SIRENE's Insee API

1.1.0 2023-09-11 12:35 UTC

This package is auto-updated.

Last update: 2024-05-11 14:38:57 UTC


README

Retrieves company and establishment data from the SIRENE's Insee API

Usage

Method on Sirene's instances:

  • rawSiret(string $siret): array to get data from the API as array
  • siret(string $siret): Etablissement to get data from the API as Etablissement
  • rawSiren(string $siren): array to get data from the API as array
  • siren(string $siren): UniteLegale to get data from the API as UniteLegale

Example:

$accessToken = AccessToken::get('SAbQGvuIEcfB8uOElaI2rkdINvAa', 'LLhFGsUWlnbDx8T9n_PINwqGZywa');
$workplace = (new Sirene($accessToken))->siret('13000766900018');
echo (string) $workplace->address;

Tip: you can cache the AccessToken for the time given in the expiresIn property.

Issues, suggestions and contributions

Please open an issue at https://gitlab.com/solidaires-informatique/sirene/-/issues

Dev tools

Code style verifications:

vendor/bin/php-cs-fixer fix --dry-run -v --diff

Static analysis:

vendor/bin/phpstan analyse --memory-limit=250M

Tests:

./vendor/bin/pest

To allow AccessTokenTest to run you need API keys from Insee : 1) Create an account at https://api.insee.fr/catalogue/. 2) Copy phpunit.xml.dist to phpunit.xml. 3) Fill the API_KEY and API_SECRET with values given in "Mes applications".

Licence

Licensed under GNU Affero General Public License v3.0 (AGPL-3.0), read more at https://choosealicense.com/licenses/agpl-3.0/