{"id":37012441,"url":"https://github.com/php-monsters/laravel-worldwide","last_synced_at":"2026-01-14T01:06:50.973Z","repository":{"id":281890266,"uuid":"946754542","full_name":"php-monsters/laravel-worldwide","owner":"php-monsters","description":"Laravel World, Countries States Cities DB Migration \u0026 Seeder","archived":false,"fork":false,"pushed_at":"2025-07-28T21:05:56.000Z","size":3245,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-28T23:09:56.743Z","etag":null,"topics":[],"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/php-monsters.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"custom":"https://monzo.me/aboozarghaffari"}},"created_at":"2025-03-11T16:14:24.000Z","updated_at":"2025-07-28T21:05:54.000Z","dependencies_parsed_at":null,"dependency_job_id":"33039e46-5227-408a-ba21-471e2f64a45b","html_url":"https://github.com/php-monsters/laravel-worldwide","commit_stats":null,"previous_names":["php-monsters/laravel-worldwide"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/php-monsters/laravel-worldwide","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/php-monsters%2Flaravel-worldwide","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/php-monsters%2Flaravel-worldwide/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/php-monsters%2Flaravel-worldwide/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/php-monsters%2Flaravel-worldwide/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/php-monsters","download_url":"https://codeload.github.com/php-monsters/laravel-worldwide/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/php-monsters%2Flaravel-worldwide/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28407639,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T00:40:43.272Z","status":"ssl_error","status_checked_at":"2026-01-14T00:40:42.636Z","response_time":56,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":[],"created_at":"2026-01-14T01:06:50.275Z","updated_at":"2026-01-14T01:06:50.964Z","avatar_url":"https://github.com/php-monsters.png","language":"PHP","funding_links":["https://monzo.me/aboozarghaffari"],"categories":[],"sub_categories":[],"readme":"```\n██████╗ ██╗  ██╗██████╗     ███╗   ███╗ ██████╗ ███╗   ██╗███████╗████████╗███████╗██████╗ ███████╗\n██╔══██╗██║  ██║██╔══██╗    ████╗ ████║██╔═══██╗████╗  ██║██╔════╝╚══██╔══╝██╔════╝██╔══██╗██╔════╝\n██████╔╝███████║██████╔╝    ██╔████╔██║██║   ██║██╔██╗ ██║███████╗   ██║   █████╗  ██████╔╝███████╗\n██╔═══╝ ██╔══██║██╔═══╝     ██║╚██╔╝██║██║   ██║██║╚██╗██║╚════██║   ██║   ██╔══╝  ██╔══██╗╚════██║\n██║     ██║  ██║██║         ██║ ╚═╝ ██║╚██████╔╝██║ ╚████║███████║   ██║   ███████╗██║  ██║███████║\n╚═╝     ╚═╝  ╚═╝╚═╝         ╚═╝     ╚═╝ ╚═════╝ ╚═╝  ╚═══╝╚══════╝   ╚═╝   ╚══════╝╚═╝  ╚═╝╚══════╝\n```\n# Php Monsters Laravel Worldwide\nThis package will allow you to add all Countries, States, Cities' Data DB Migration \u0026 Seeder for Laravel 10+\n\n[![Latest Version on Packagist](https://img.shields.io/packagist/v/php-monsters/laravel-worldwide.svg?style=flat-square)](https://packagist.org/packages/php-monsters/laravel-worldwide)\n[![GitHub Tests Action Status](https://img.shields.io/github/actions/workflow/status/php-monsters/laravel-worldwide/run-tests.yml?branch=main\u0026label=tests\u0026style=flat-square)](https://github.com/php-monsters/laravel-worldwide/actions?query=workflow%3Arun-tests+branch%3Amain)\n[![GitHub Code Style Action Status](https://img.shields.io/github/actions/workflow/status/php-monsters/laravel-worldwide/fix-php-code-style-issues.yml?branch=main\u0026label=code%20style\u0026style=flat-square)](https://github.com/php-monsters/laravel-worldwide/actions?query=workflow%3A\"Fix+PHP+code+style+issues\"+branch%3Amain)\n[![Total Downloads](https://img.shields.io/packagist/dt/php-monsters/laravel-worldwide.svg?style=flat-square)](https://packagist.org/packages/php-monsters/laravel-worldwide)\n\n\n## Number of entity records\n| Model   | Number of items |\n|---------|-----------------|\n| Country | 250             |\n| State   | 4961            |\n| City    | 148059          |\n\n\n## Attributes\n\nCommon attributes:\n\n- `name`: Common name of Country (English).\n- `iso2`: ISO-3166-2 code.\n- `iso2`: ISO-3166-3 code.\n- `numeric_code`: Country Numeric code.\n- `phonecode`: Country Phone code.\n- `capital`: Capital of this country.\n- `currency`: ISO-4177 Currency Code, e.g., USD, CNY.\n- `currency_name`: Currency Name.\n- `currency_symbol`: Currency Symbol e.g. $, ¥.\n- `tld`: Country code top-level domain e.g..uk.\n- `native`: Local name of the country.\n- `region`: region of the country.\n- `subregion`: Subregion of the country.\n- `timezones`: timezones the country.\n    - `zoneName`: Zone Name e.g., America/New_York.\n    - `gmtOffset`: GMT offset e.g. -18000.\n    - `gmtOffsetName`: GMT offset Name e.g., UTC-05:00.\n    - `abbreviation`: abbreviation e.g. EST.\n    - `tzName`: time zone Name e.g., Eastern Standard Time (North America).\n- `translations`: Country name translations e.g.\n    - \"ar\": \"الولايات المتحدة الأمريكية\"\n    - \"kr\": \"미국\"\n    - \"fr\": \"États-Unis\"\n- `latitude`: latitude the country.\n- `longitude`: latitude the country.\n- `emoji`: Emoji flag of country e.g. 🇺🇸.\n- `emojiU`: Emoji Unicode flag of country e.g., U+1F1FA U+1F1F8.\n- `flag`: Country has flag (boolean).\n- `is_active`: Country has active (boolean).\n\n\n## Installation\n\nYou can install the package via composer:\n\n```bash\ncomposer require php-monsters/laravel-worldwide\n```\n\n## Usage\nNow run the following command to install.\n```bash\nphp artisan worldwide:install\n```\n\nAdd seeder File in `database\\seeders\\DatabaseSeeder.php` add this line to use `php artisan db:seed` command.\n```php\npublic function run(): void\n    {\n        $this-\u003ecall(WorldTableSeeder::class);\n        ...\n    }\n```\n\nOr you can Seed Data of Countries, States and Cities, by run this command.\n```bash\nphp artisan world:seeder\n```\n\nAnd you can refresh to re-seeding Data of Countries, States and Cities, by run this command.\n```bash\nphp artisan world:seeder --refresh\n```\n\nYou can specify the activation of countries through the country code ISO2 or ISO3,\nbefore processing the seed data in the config file. `config/worldwide.php`\n```php\nreturn [\n    'insert_activations_only' =\u003e false,\n    'countries' =\u003e [\n        'activation' =\u003e [\n            'default' =\u003e true,\n            'only' =\u003e [\n                'iso2' =\u003e ['SA','GB','DE'],\n                'iso3' =\u003e ['USA','BRA','EGY'],\n            ],\n            'except' =\u003e [\n                'iso2' =\u003e ['GA'],\n                'iso3' =\u003e ['HTI'],\n            ],\n        ],\n        'chunk_length' =\u003e 50,\n    ],\n\n    'states' =\u003e [\n        'activation' =\u003e [\n            'default' =\u003e true,\n        ],\n        'chunk_length' =\u003e 200,\n    ],\n\n    'cities' =\u003e [\n        'activation' =\u003e [\n            'default' =\u003e true,\n        ],\n        'chunk_length' =\u003e 200,\n    ],\n];\n```\nIf you need to insert the countries is activation, this insert only two Countries `( Albania , Argentina )` with States and Cities.\n```php\nreturn [\n    'insert_activations_only' =\u003e true,\n    'countries' =\u003e [\n        'activation' =\u003e [\n            'default' =\u003e true,\n            'only' =\u003e [\n                'iso2' =\u003e ['AL','AR'],\n                'iso3' =\u003e [],\n            ],\n            'except' =\u003e [\n                'iso2' =\u003e [],\n                'iso3' =\u003e [],\n            ],\n        ],\n        'chunk_length' =\u003e 50,\n    ],\n\n    ...\n];\n```\n\n\nThis means that only these two countries and the states and cities affiliated with them will be activated.\n+ Note: If activation only `iso2` an `iso3` are empty, the column is_active take the `default` value in a config file.\n+ Note: If the Country is active, all States and Cities are active.\n+ Note: If activation except `iso2` or `iso3` the column is_active take FALSE value.\n+ Note: If the Country is not active, all States and Cities are not active.\n\n\n## Usage\n\nyou can get country by iso2 and iso3 or both.\n\nif you want to get country by iso2 you can yes static function getByIso2\n```php\nuse App\\Models\\Country;\n\n$sa = Country::getByIso2('IR');\n$sa-\u003ename; // Iran\n$sa-\u003eiso2; // IR\n$sa-\u003eiso3; // IRN\n$sa-\u003ecurrency_symbol; // ﷼\n$sa-\u003enative; // ایران\n```\n\nif you want to get country by iso3 you can use.\n```php\nuse App\\Models\\Country;\n\n$bra = Country::getByIso3('BRA');\n$bra-\u003ename; // Brazil\n$bra-\u003eiso2; // BR\n$bra-\u003eiso3; // BRA\n$bra-\u003ecurrency_symbol; // R$\n$bra-\u003enative; // Brasil\n```\nalso if you want to get country by code iso2 ro iso3 you can use.\n```php\nuse App\\Models\\Country;\n\n$bra = Country::getByCode('PT');\n$bra-\u003ename; // Portugal\n$bra-\u003eiso2; // PT\n$bra-\u003eiso3; // PRT\n$bra-\u003ecurrency_symbol; // €\n$bra-\u003enative; // Portugal\n```\n\n### Scope\nyou can use Scope to filter data is Active by use.\n\n```php\nuse App\\Models\\Country;\n\n$countries = Country::active()-\u003epluck('name','id');\n```\n\n## Credits\n\n- [Aboozar Ghaffari](https://github.com/samuraee)\n- [All Contributors](../../contributors)\n\n## License\n\nThe MIT License (MIT). Please see [License File](LICENSE.md) for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphp-monsters%2Flaravel-worldwide","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fphp-monsters%2Flaravel-worldwide","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphp-monsters%2Flaravel-worldwide/lists"}