oriatec / laravel-insee-localisation
Package to import and use Insee Localisation Data
v1.0.2
2021-08-25 12:48 UTC
Requires
- php: ^7.4
- laravel/framework: ^8.0
- rodenastyle/stream-parser: ^1.3
This package is auto-updated.
Last update: 2024-10-27 18:19:55 UTC
README
This package provide an implementation of Insee French Localisation Data with a import command
Installation
Add the ORIATEC private packagist repositories
composer config repositories.private-packagist composer https://repo.packagist.com/oriatec/
Install the package
composer require oriatec/laravel-insee-localisation
Run migrations
php artisan migrate
Usage
Import Insee Data
To import Insee Data, run
php artisan insee:import
Use the data in your application
Model LocalisationCity
Represent a city with all informations, the department and region.
Model LocalisationDepartment
Represent a department with all informations and region
Model LocalisationRegion
Represent a region
Eloquent Model Localisation
Is the Eloquent Model use to request the database.
It provides static method to generate LocalisationCity, LocalisationDepartment or LocalisationRegion
use ORIATEC\InseeLocalisation\Models\Localisation; // Random Localisation $city = Localisation::randomCity(); $department = Localisation::randomDepartment(); $region = Localisation::randomRegion(); // Localisation Check Localisation::cityIsInDepartment($zipcode, $department_code); Localisation::cityIsInRegion($zipcode, $region_code); Localisation::departmentIsInRegion($department_code, $region_code); // City $cities = Localisation::cities(); $cities = Localisation::citiesInDepartment($department_code); $cities = Localisation::citiesInRegion($region_code); $city = Localisation::city($zipcode); // Department $departments = Localisation::departments(); $departments = Localisation::departmentsInRegion($region_code); $department = Localisation::department($department_code); $department = Localisation::departmentForCity($zipcode); // Region $regions = Localisation::regions(); $region = Localisation::region(); $region = Localisation::regionForDepartment($department_code); $region = Localisation::regionForCity($zipcode);
Changelog
Please see changelog.md for what has changed recently.
License
This package belongs to ORIATEC SARL. You must have an authorization to use it.