A package build on Laravel 5 which provides a list of all the the Countries with their states and suburbs
josephmmendez/gazetteer is a Laravel package for a package build on laravel 5 which provides a list of all the the countries with their states and suburbs.
It currently has 0 GitHub stars and 119 downloads on Packagist (latest version v1.0).
Install it with composer require josephmmendez/gazetteer.
Discover more Laravel packages by josephmmendez
or browse all Laravel packages to compare alternatives.
Last updated
A package build on Laravel 5 which provides a list of all the the Countries with their states and suburbs
Countries available right now:-
1- composer require josephmmendez/gazetteer
Open the file config\app.php
Add the following line to the providers array
Subbe\Gazetteer\GazetteerServiceProvider::class,
and this to the aliases array
'Gazetteer' => Subbe\Gazetteer\Facades\GazetteerFacade::class,
2- php artisan vendor:publish
Running this command will publish the migration and seed files to your application's 'migrations' and 'seeds' folder.
Update your DatabaseSeeder.php file found in your database/seeds folder and add the following to it.
$this->call(CountryTableSeeder::class);
$this->call(StateTableSeeder::class);
$this->call(SuburbTableSeeder::class);
$this->call(MaldiveIslandsTableSeeder::class);
Now run
3- composer dump-autload
4- php artisan migrate
This will add the 'countries', 'states', and 'suburbs' table to your database.
5- php artisan db:seed
Populate the tables created.
Gazetteer::countries() -> returns a collection of available countriesGazetteer::countries($country_code) -> returns an instance of the requested country (searched by country code)Gazetteer::countries($country_name) -> returns an instance of the requested country (searched by country name)Gazetteer::states($country_code) -> returns a collection of states for a given country (searched by country code)Gazetteer::states($country_name) -> returns a collection of states for a given country (searched by country name)Gazetteer::suburbs($country, $states) -> returns a collection of states for a given country (searched by country name)Gazetteer::suburb($input) -> returns an instance of a suburb for a given postcode (searched by postcode)Gazetteer::suburb($input) -> returns an instance of a suburb for a given suburb name (searched by suburb name)