Skip to content

A simple Laravel Package to sort Countries, States and Cities

License

Notifications You must be signed in to change notification settings

ekpono/laravel-location

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Laravel Location ▲

hero

Introduction 🖖

This Package offers a simple way to get Countries, Cities and States that you may need for your Application, most especially for dropdown menus.

Installation 💽

Step One

Require the package via composer into your project

composer require ichtrojan/laravel-location

composer install

Step Two

Next, publish the Seeders from the package

php artisan vendor:publish --tag=laravel-location-seeds

or Run

php artisan vendor:publish

You will end up with a selection like this

vendor publish

input the number that matches with Ichtrojan\Location\LocationServiceProvider and press enter.

vendor published

Step Three

Run migrations

before you do this make sure your correct Database credentials are set in the .env file

php artisan migrate

migrations

Finally, run the Package seeders

php artisan db:seed --class=LocationDatabaseSeeder

seeds

Usage 🧨

Endpoint Description
/location/countries return all countries
/location/country/{id} return a single country by its ID
/location/states return all states
/location/state/{id} return a single state by its ID
/location/states/{countryID} return all states in a country using the country ID
/location/cities return all cities
/location/city/{id} return a single city by its ID
/location/cities/{stateID} return all cities in a state using the state ID

Contribution

Free for all, if you find an issue with the package or if a group of people somehow created a new country please send in a PR.

Danke Schön

About

A simple Laravel Package to sort Countries, States and Cities

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • PHP 100.0%