rajibbinalam/country-state-city

find country state and cities all over the world


README

Latest Version on Packagist Total Downloads

This Package is provid you world info about the country state and city name with their some local information

Installation

You can install the package via composer:

composer require rajibbinalam/country-state-city

Publish Vendor Files: Find the below files

  • config > CountryStateCity.php
  • database > migrations > country , state, city and timezone
  • database > seeders > country , state, city and timezone
php artisan vendor:publish 
# Provider: rajib\LaravelCountryStateCity\CountryStateCityServiceProvider

Configuration The Migrations Table Name and Field

return [
    
	/*
	|--------------------------------------------------------------------
	| Configaration Your Migrations.
    |----------------------------------------------------------------
    | Set the table_name or use default LIKE: 'table_name' => 'countries',
    |----------------------------------------------------------------
    | 'required' => true, will be added to the migration as a field
	|---------------------------------------------------------------------
	*/
	'migrations' => [
		'countries' => [
			'table_name' => 'countries',
			'optional_fields' => [
				'phone_code' => [
					'required' => true,
					'length' => 5,
				],
				'iso3' => [
					'required' => false,
					'length' => 3,
				],
			],
		],
	],
];

Migrate

php artisan migrate

Database Seed

Register the Seeders file to your DatabaseSeeder.php and run the seed commands

$this->call([
    CountryTableSeeder::class,
    StateTableSeeder::class,
    CityTableSeeder::class,
    TimezoneTableSeeder::class,
]);
php artisan db:seed    # it's need some time to seed the database

Contributing

We will accept your Contribution with respect. Please see CONTRIBUTING for details.

Credits

License

The MIT License (MIT). Please see License File for more information.