lufiipe / insee-sierene
A PHP package for retrieving company information from the INSEE Sirene API
1.0.0
2025-06-26 08:05 UTC
Requires
- php: ^7.4|^8.0
- guzzlehttp/guzzle: ^7.0
- lufiipe/simplevent: ^1.0
Requires (Dev)
- phpstan/phpstan: ^2.1
- phpunit/phpunit: ^9.0|^10.0|^11.0
This package is auto-updated.
Last update: 2025-06-26 12:57:53 UTC
README
INSEE Sirene client for PHP
The INSEE Sirene client package is a PHP library that provides a simple and easy-to-use interface for interacting with the INSEE API. It allows you to retrieve legal data, such as company information.
With this package, you can:
- ✅ Advanced search
- ✅ Facets
- ✅ Iterates over the items in the collection
- ✅ API Rate Limiting
- ✅ Event listener
Install
composer require lufiipe/insee-sierene
Usage
require_once "vendor/autoload.php"; use LuFiipe\InseeSierene\Exception\SireneException; use LuFiipe\InseeSierene\Parameters\SearchParameters; use LuFiipe\InseeSierene\Sirene; $sirene = new Sirene('YOUR-API-KEY'); // Get legal entity details by SIREN number $sirene->siren('120027016')->getBody(); // Get establishment details by SIRET Number $sirene->siret('12002701600563')->getBody(); // Searches for legal entities whose name currently contains or previously contained the term "INSEE" $parameters = (new SearchParameters) ->setQuery('periode(denominationUniteLegale:INSEE)'); $collection = $sirene->searchLegalUnits($parameters); $collection->each(function (array $legalUnit) { var_dump($legalUnit); }); // Retrieves establishments containing the name "WWF" $parameters = (new SearchParameters) ->setQuery('denominationUniteLegale:"WWF"'); $collection = $sirene->searchEstablishments($parameters); $collection->each(function (array $establishment) { var_dump($establishment); }); // INSEE Sirene Service Status try { $res = $sirene->informations(); } catch (SireneException $e) { // ../.. }
Documentation
You can find detailed instructions on how to use this package at the dedicated documentation site.
Tests
Copy the file phpunit.xml.dist
to phpunit.xml
and update the value of the INSEE_API_KEY
variable with your api key.
Then, run:
composer test
License
The MIT License (MIT). Please see License File for more information.