PHP code example of oriatec / laravel-insee-localisation

1. Go to this page and download the library: Download oriatec/laravel-insee-localisation library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

oriatec / laravel-insee-localisation example snippets


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);
bash
php artisan migrate