bhuvidya / laravel-countries
Laravel Countries is a bundle for Laravel, providing Almost ISO 3166_2, 3166_3, currency, Capital and more for all countries. Bug kudos to Christoph Kempen, on whose work this package is heavily based (webpatser/laravel-countries).
Installs: 18 779
Dependents: 1
Suggesters: 0
Security: 0
Stars: 7
Watchers: 2
Forks: 7
Open Issues: 2
Requires
- php: >=7.0.0
- illuminate/database: ^5.5|^6.0|^7.0|^8.0|^9.0|^10.0|^11.0
- illuminate/support: ^5.5|^6.0|^7.0|^8.0|^9.0|^10.0|^11.0
README
Note I have now switched the semver versioning for my Laravel packages to "match" the latest supported Laravel version.
Laravel Countries is a bundle for Laravel, providing ISO 3166_2, 3166_3, currency, capitals and more for all countries.
Big kudos to Christoph Kempen, on whose work this package is heavily based (https://github.com/webpatser/laravel-countries). I ended up doing so many little changes that I thought it best to start my own package. And this is the first package I have put together and added to Packagist etc, so I was keen to learn the whole process!
Please note that this package was tested on Laravel 5.5 - I cannot guarantee it will work on earlier versions. Sorry.
Installation
Add bhuvidya/laravel-countries
to your app:
$ composer require "bhuvidya/laravel-countries"
If you're using Laravel 5.5, you don't have to edit app/config/app.php
.
Otherwise, edit app/config/app.php
and add the service provider:
'providers' => [
'Bhuvidya\Countries\CountriesServiceProvider',
]
Configuration
You can elect to manage your own configuration. This is an optional step, it only contains the table name and does
not need to be altered. If the default table name countries
suits you, leave it. Otherwise run the following command
$ php artisan vendor:publish --provider='Bhuvidya\Countries\CountriesServiceProvider' --tag=config
The config file can then be found at config/countries.php
.
Migrations
The service provider automatically adds the package's migrations to your app.
Seeding
There is a seeding module in the package. You can either run the seeder manually from the command line:
$ php artisan db:seed --class='Bhuvidya\Countries\CountriesSeeder'
Otherwise you can add it to one of your app's database seeder files, probably database/seeds/DatabaseSeeder.php
:
use Bhuvidya\Countries\CountriesSeeder;
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
...
$this->call(CountriesSeeder::class);
...
}