dmitriymarley/laraglobe

This package is abandoned and no longer maintained. No replacement package was suggested.

Provide countries list with country code, cities and states

Installs: 2 785

Dependents: 0

Suggesters: 0

Security: 0

Stars: 5

Watchers: 2

Forks: 2

Open Issues: 1

Type:package

1.0.2 2017-04-23 19:14 UTC

This package is not auto-updated.

Last update: 2021-04-18 20:30:32 UTC


README

LaraGlobe Logo

Installation

Via Composer

$ composer require dmitriymarley/laraglobe

Manual

To install package manually, just add the following line into your composer.json file

"dmitriymarley/laraglobe": "1.0.*"

and run

composer update

Configuration

After you installed the package via composer, you need to add the following line into your config/app.php file:

DmitriyMarley\LaraGlobe\LaraGlobeServiceProvider::class,

Also, you may add an alias into aliases array in order to use LaraGlobeFacade:

'Globe' => DmitriyMarley\LaraGlobe\Facades\LaraGlobeFacade::class,

Next, to populate your database, you need to run:

php artisan globe:populate

The globe:drop command will remove all tables and data:

php artisan globe:drop

Basic Usage

To get all the countries from your database, you can use the following:

Globe::getCountries()

You can get countries with states by using getCountriesWithStates method, like so:

Globe::getCountriesWithStates()

And also, you can get countries with states and cities:

Globe::getCountriesithStatesAndCities()

To perform a custom SQL query, there are 3 methods to get the Country, City and State models themselves:

Globe::getCountryModel() // will return default Country model
Globe::getCityModel() // will return default City model
Globe::getStateModel() // will return default State model
Credits
Countries, state and cities mysql dump from: cristiroma