https://github.com/znck/cities
A list of cities.
https://github.com/znck/cities
cities laravel
Last synced: 6 months ago
JSON representation
A list of cities.
- Host: GitHub
- URL: https://github.com/znck/cities
- Owner: znck
- License: mit
- Created: 2016-03-15T11:03:05.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2016-12-12T10:39:46.000Z (almost 9 years ago)
- Last Synced: 2025-04-14T21:53:10.763Z (6 months ago)
- Topics: cities, laravel
- Language: PHP
- Size: 376 KB
- Stars: 4
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Cities
======
A cities list provider for [Laravel](https://laravel.com/).
## Installation
Either [PHP](https://php.net) 7.0+ is required.
To get the latest version of cities, simply require the project using [Composer](https://getcomposer.org):
```bash
$ composer require znck/cities
```Instead, you may of course manually update your require block and run `composer update` if you so choose:
```json
{
"require": {
"znck/cities": "^0.1.2"
}
}
```Once `Cities` is installed, you have to register its service provider. Open `config/app.php` and add `Znck\Cities\CitiesServiceProvider::class` to `providers` key. Your `config/app.php` should look like this.
```php
[
// ....
Znck\Cities\CitiesServiceProvider::class,
]
// ...
];
```## Usage
- Use `City` trait in you [Eloquent](https://laravel.com/docs/master/eloquent) model.```php
increments('id');
$table->string('name');
$table->string('code', 2)->unique();
$table->timestamps();
});Schema::create('states', function (Blueprint $table) {
$table->increments('id');
$table->string('name');
$table->string('code', 5)->unique();
$table->unsignedInteger('country_id');
$table->timestamps();$table->foreign('country_id')->references('id')->on('countries');
});Schema::create('cities', function (Blueprint $table) {
$table->increments('id');
$table->string('name');
$table->string('code', 10)->unique();
$table->unsignedInteger('state_id');
$table->timestamps();$table->foreign('state_id')->references('id')->on('states');
});```
## Development plan
* [x] Create minimal working package.
* [ ] Add migrations.
* [ ] Integrate `znck/state` and `znck/countries`.
* [ ] Add major cities of India.
* [ ] Add translations in all 23 languages.
* [ ] Add major cities of World.## License
Cities is licensed under [The MIT License (MIT)](LICENSE).