PHP code example of kblais / france-cities-seeds

1. Go to this page and download the library: Download kblais/france-cities-seeds 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/ */

    

kblais / france-cities-seeds example snippets


$regions = Kblais\FranceCitiesSeeds\extractFromFile('/path/to/csv/file.csv');

[
    11 => [
        "name" => "ILE-DE-FRANCE",
        "code" => "11",
        "departments" => [
            78 => [
                "name" => "YVELINES",
                "code" => "78",
                "cities" => [
                    78165 => [
                        "insee_code" => "78165",
                        "name" => "Les Clayes-sous-Bois",
                        "surface" => "6111331.000000000000000",
                        "lat" => "1.983682382432120",
                        "lon" => "48.818793614296297",
                        "status" => "Commune simple",
                        "population" => "17.5",
                        "canton_code" => "38",
                        "district_code" => "4",
                    ],
                    78674 => [
                        "insee_code" => "78674",
                        "name" => "Villepreux",
                        "surface" => "10446819.000000000000000",
                        "lat" => "2.012416565085020",
                        "lon" => "48.831123160333597",
                        "status" => "Commune simple",
                        "population" => "9.9",
                        "canton_code" => "22",
                        "district_code" => "3",
                    ],
                    ...
                ],
            ],
            ...
        ],
    ],
    ...
]