routmoute / routmoute-sirene-bundle
Bundle to use INSEE Sirene API with Symfony 6
Installs: 139
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 1
Open Issues: 0
Type:symfony-bundle
Requires
- symfony/cache: ^6.0
- symfony/config: ^6.0
- symfony/dependency-injection: ^6.0
- symfony/http-client: ^6.0
- symfony/http-kernel: ^6.0
Requires (Dev)
- symfony/phpunit-bridge: ^6.0
README
Bundle to use INSEE Sirene API with Symfony 6
Manual Installation
Make sure Composer is installed globally, as explained in the installation chapter of the Composer documentation.
Step 1: Create configuration file
Create configuration file config/packages/routmoute_sirene.yaml
and modify scopes if you want
// config/packages/routmoute_sirene.yaml routmoute_sirene: consumer_key: '%env(ROUTMOUTE_SIRENE_CONSUMER_KEY)%' consumer_secret: '%env(ROUTMOUTE_SIRENE_CONSUMER_SECRET)%'
Configuration
Step 1: Create your INSEE Application
- Go to https://api.insee.fr
- Create a New Application
- Copy
consumer-key
andconsumer-secret
for next step
Step 2: Create your env variables
Add this environments vars in your .env
file.
ROUTMOUTE_SIRENE_CONSUMER_KEY=YourConsumerKey
ROUTMOUTE_SIRENE_CONSUMER_SECRET=YourConsumerSecret
Usage
Example usage in Controller:
<?php namespace App\Controller; use Routmoute\Bundle\RoutmouteSireneBundle\Service\RoutmouteSireneApiService; class MyController extends AbstractController { public function index(RoutmouteSireneApiService $sireneAPI) { // search company by siret $companyInfos = $sireneAPI->siret("<siret>"); // search company by siren $companyInfos = $sireneAPI->siren("<siren>"); /* search company by etablissement infos Array of search (required) [ "city" => "libelleCommuneEtablissement", "cp" => "codePostalEtablissement", "company" => "denominationUniteLegale", "sigle" => "sigleUniteLegale", "ape" => "activitePrincipaleUniteLegale", "cj" => "categorieJuridiqueUniteLegale" ] orderBy (default "siren") "siret" or "siren" Int page (default 1) Int number of results by page (default 20) */ $companyInfos = $sireneAPI->searchEtablissement([ "city" => "PARIS" ], "siren", 1, 10); } }
Parameters
consumer_key
Required
The consumer_key
provided by insee
consumer_secret
Required
The consumer_secret
provided by insee