Coder Social home page Coder Social logo

laravel-insee's Introduction

Laravel Insee

This package is a Laravel wrapper allowing you to lookup SIREN and SIRET numbers of French businesses and nonprofit associations, attributed by Insee (Institut national de la statistique et des études économiques).

Laravel Insee uses the Sirene V3 API.

Installation

You can install this package via Composer:

composer require nspehler/laravel-insee

If you are using Laravel 5.5 or later, the service provider and facade will be discovered automatically.

On earlier versions, you need to do that manually. You must install the service provider:

// config/app.php
'providers' => [
    ...
    NSpehler\LaravelInsee\InseeServiceProvider::class,
];

And register an alias for the Insee facade:

// config/app.php
'aliases' => [
    ...
    'Insee' => NSpehler\LaravelInsee\Facades\Insee::class,
];

Configuration

To get started, sign up on https://api.insee.fr and create a new application. From the "Production Keys" tab, you'll be able to generate your Consumer Key and Consumer Secret.

Make sure to subscribe your new app to the Sirene V3 API to grant it access.

Then, you can add your production keys as environment variables in your .env file:

INSEE_CONSUMER_KEY=
INSEE_CONSUMER_SECRET=

Optionally, you can edit the name of these variables by publishing the configuration file:

php artisan vendor:publish --provider="NSpehler\LaravelInsee\InseeServiceProvider" --tag="config"

Usage

Use the Insee facade to lookup a SIREN or SIRET number:

Insee::siren('840 745 111');
Insee::siret('840 745 111 00012');

Credits

Testing

This project uses BrowserStack for cross browser testing. We're grateful for their contribution to the open source community.

License

The MIT License (MIT). Please see License File for more information.

laravel-insee's People

Contributors

nspehler avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

laravel-insee's Issues

Siren Lookup

Is it planned to add the possibility to use other INSEE's APIs (Multi-criteria search) ?

erreur 401

Facade\Ignition\Exceptions\ViewException
Client error: `POST https://api.insee.fr/token` resulted in a `401 Unauthorized` response: {"error_description":"Error decoding authorization header. Space delimited \"<authMethod> <base64Hash>\" format violated (truncated...) 

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.