Skip to content
A simple Laravel Package to sort Countries, States and Cities
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
publishable/database/seeds Clean Up 🚀 May 11, 2019
src changed tag name for seeds May 11, 2019
.gitignore
LICENSE Initial commit May 10, 2019
README.md Added Readme 🚀🚀🚀 May 11, 2019
composer.json updated path May 11, 2019

README.md

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

You can’t perform that action at this time.