{"id":20588533,"url":"https://github.com/znck/cities","last_synced_at":"2025-04-14T21:53:20.723Z","repository":{"id":57091633,"uuid":"53937543","full_name":"znck/cities","owner":"znck","description":"A list of cities.","archived":false,"fork":false,"pushed_at":"2016-12-12T10:39:46.000Z","size":385,"stargazers_count":4,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-14T21:53:10.763Z","etag":null,"topics":["cities","laravel"],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/znck.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-03-15T11:03:05.000Z","updated_at":"2019-02-25T06:11:13.000Z","dependencies_parsed_at":"2022-08-22T20:40:30.202Z","dependency_job_id":null,"html_url":"https://github.com/znck/cities","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/znck%2Fcities","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/znck%2Fcities/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/znck%2Fcities/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/znck%2Fcities/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/znck","download_url":"https://codeload.github.com/znck/cities/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248968754,"owners_count":21191158,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cities","laravel"],"created_at":"2024-11-16T07:25:03.314Z","updated_at":"2025-04-14T21:53:20.696Z","avatar_url":"https://github.com/znck.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"Cities\n======\nA cities list provider for [Laravel](https://laravel.com/).\n\n![Cities](cover.png)\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://styleci.io/repos/53937543\"\u003e\n    \u003cimg src=\"https://styleci.io/repos/53937543/shield\" alt=\"StyleCI Status\" /\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://circleci.com/gh/znck/cities\"\u003e\n    \u003cimg src=\"https://circleci.com/gh/znck/cities.svg?style=svg\" alt=\"Build Status\" /\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://coveralls.io/github/znck/cities?branch=master\"\u003e\n    \u003cimg src=\"https://coveralls.io/repos/github/znck/cities/badge.svg?branch=master\u0026style=flat-square\" alt=\"Coverage Status\" /\u003e\n  \u003c/a\u003e\n  \u003ca href=\"LICENSE\"\u003e\n    \u003cimg src=\"https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square\" alt=\"Software License\" /\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://packagist.org/packages/znck/cities\"\u003e\n    \u003cimg src=\"https://img.shields.io/packagist/v/znck/cities.svg?style=flat-square\" alt=\"Packagist\" /\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://github.com/znck/cities/releases\"\u003e\n    \u003cimg src=\"https://img.shields.io/github/release/znck/cities.svg?style=flat-square\" alt=\"Latest Version\" /\u003e\n  \u003c/a\u003e\n\n  \u003ca href=\"https://github.com/znck/cities/issues\"\u003e\n    \u003cimg src=\"https://img.shields.io/github/issues/znck/cities.svg?style=flat-square\" alt=\"Issues\" /\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\n## Installation\n\nEither [PHP](https://php.net) 7.0+ is required.\n\nTo get the latest version of cities, simply require the project using [Composer](https://getcomposer.org):\n\n```bash\n$ composer require znck/cities\n```\n\nInstead, you may of course manually update your require block and run `composer update` if you so choose:\n\n```json\n{\n    \"require\": {\n        \"znck/cities\": \"^0.1.2\"\n    }\n}\n```\n\nOnce `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.\n\n```php\n\u003c?php return [\n  // ...\n  'providers' =\u003e [\n    // ....\n    Znck\\Cities\\CitiesServiceProvider::class,\n  ]\n  // ...\n];\n```\n\n## Usage\n- Use `City` trait in you [Eloquent](https://laravel.com/docs/master/eloquent) model.\n\n```php\n\u003c?php namespace App;\n\nuse Illuminate\\Database\\Eloquent\\Model;\nuse Znck\\Cities\\City as CityTrait;\n\nclass City extends Model {\n  use CityTrait;\n}\n```\n\n- Cities provides command (`php artisan cities:update`) to update list in database.\n\n## Configuration\nTable names for cities and states are required. By default `cities` and `states` are used, but you can override these.\n\nTo get started, you'll need to publish all vendor assets:\n\n```\nphp artisan vendor:publish --provider='Znck\\Cities\\CitiesServiceProvider'\n```\n\nThis 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.\n\n## Conventions\nExpected schema:\n\n```php\nSchema::create('countries', function (Blueprint $table) {\n    $table-\u003eincrements('id');\n    $table-\u003estring('name');\n    $table-\u003estring('code', 2)-\u003eunique();\n    $table-\u003etimestamps();\n});\n\nSchema::create('states', function (Blueprint $table) {\n    $table-\u003eincrements('id');\n    $table-\u003estring('name');\n    $table-\u003estring('code', 5)-\u003eunique();\n    $table-\u003eunsignedInteger('country_id');\n    $table-\u003etimestamps();\n\n    $table-\u003eforeign('country_id')-\u003ereferences('id')-\u003eon('countries');\n});\n\nSchema::create('cities', function (Blueprint $table) {\n    $table-\u003eincrements('id');\n    $table-\u003estring('name');\n    $table-\u003estring('code', 10)-\u003eunique();\n    $table-\u003eunsignedInteger('state_id');\n    $table-\u003etimestamps();\n\n    $table-\u003eforeign('state_id')-\u003ereferences('id')-\u003eon('states');\n});\n\n```\n\n\n## Development plan\n* [x] Create minimal working package.\n* [ ] Add migrations.\n* [ ] Integrate `znck/state` and `znck/countries`.\n* [ ] Add major cities of India.\n* [ ] Add translations in all 23 languages.\n* [ ] Add major cities of World.\n\n## License\nCities is licensed under [The MIT License (MIT)](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fznck%2Fcities","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fznck%2Fcities","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fznck%2Fcities/lists"}