New

Just launched: Vueblocks, a brand-new search engine for Vue packages! Explore Vueblocks →

znck/cities

A list of cities
1,195 4

Larablocks Analysis

znck/cities works with Laravel 5 (latest release v0.1.4, Sep 29, 2016), which reached end of life: no more fixes, even for security.

Recommendation checks

Not advised

Not advised: no release or commit in over 2 years.

  • No release or commit in over 2 years
  • Supports only Laravel 5, past end of life
  • No release in the last 12 months (last: Sep 29, 2016)
  • 2 downloads a month (needs 10,000)
  • 4 GitHub stars (needs 100)

State

Likely abandoned
  • No release or commit in over 2 years.
  • Last stable release: Sep 29, 2016.
  • No releases in the last 12 months.
  • First released: Mar 15, 2016.
  • Monthly downloads: 2.
  • 0 open issues on GitHub.

Data from Packagist and GitHub, checked by Larablocks on Dec 2, 2026.

Install
composer require znck/cities
Latest Version:v0.1.4
PHP:>7.0
Laravel:5
License:MIT
Last Updated:Dec 12, 2016
Links: GitHub  ·  Packagist
Maintainer: znck

Cities

A cities list provider for Laravel.

Cities

StyleCI Status Build Status Coverage Status Software License Packagist Latest Version Issues

Installation

Either PHP 7.0+ is required.

To get the latest version of cities, simply require the project using Composer:

$ composer require znck/cities

Instead, you may of course manually update your require block and run composer update if you so choose:

{
    "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 return [
  // ...
  'providers' => [
    // ....
    Znck\Cities\CitiesServiceProvider::class,
  ]
  // ...
];

Usage

<?php namespace App;

use Illuminate\Database\Eloquent\Model;
use Znck\Cities\City as CityTrait;

class City extends Model {
  use CityTrait;
}
  • Cities provides command (php artisan cities:update) to update list in database.

Configuration

Table names for cities and states are required. By default cities and states are used, but you can override these.

To get started, you'll need to publish all vendor assets:

php artisan vendor:publish --provider='Znck\Cities\CitiesServiceProvider'

This will create a config/cities.php file in your app that you can modify to set your configuration. Also, make sure you check for changes to the original config file in this package between releases.

Conventions

Expected schema:

Schema::create('countries', function (Blueprint $table) {
    $table->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

  • 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).

Related Packages

igaster/laravel_cities

Seed all countries/cities from geonames.org database. Searchable DB tree, ready...

98,406 180
altwaireb/laravel-world

Laravel World, Countries States Cities DB Migration & Seeder

21,165 101
gerardojbaez/geodata

Laravel 5.2 package that provides basic geographical data like Countries, Region...

11,994 31
brnysn/laravel-world

The simplest way to add country, state and city to Laravel application.

3,565 3
arnotae/frenchcities

Mysql table of french cities for Laravel 5

37 0

Version History

Version Released PHP Laravel License
v0.1.4 >7.0 ^5.2 MIT
v0.1.3 >7.0 ^5.2 MIT
v0.1.2 >7.0 ^5.2 MIT
v0.1.1 >7.0 ^5.2 MIT
v0.1.0 >7.0 ^5.2 MIT