codedge/lumen-countries

Lumen Countries is a bundle for Lumen, providing ISO 3166_2, 3166_3, currency, capital and more for all countries. It is based on Laravel-Countries made by webpatser (Christoph Kempen).

1.6.1 2017-04-29 21:53 UTC

README

StyleCI Latest Stable Version Total Downloads License

Lumen Countries is a bundle for Lumen 5.x, providing ISO 3166_2, 3166_3, currency, capital and more for all countries. It is based on Laravel-Countries made by webpatser (Christoph Kempen).

Installation

Install the package running:

$ composer require codedge/lumen-countries

Edit bootstrap/app.php and add the Service Provider [1]

/*
|--------------------------------------------------------------------------
| Register Service Providers
|--------------------------------------------------------------------------
|
...    

*/

$app->register(Codedge\Countries\CountriesServiceProvider::class); // [1]

Also register the vendor:publish command in your app/Console/Kernel.php

/**
 * The Artisan commands provided by your application.
 *
 * @var array
 */
protected $commands = [
    // ...
    BasicIT\LumenVendorPublish\VendorPublishCommand::class
];

Model

You can start by publishing the configuration. This is an optional step, it contains the table name and does not need to be altered. If the default name countries suits you, leave it. Otherwise run the following command

$ php artisan vendor:publish --provider="Codedge\Countries\CountriesServiceProvider"

Next generate the migration file:

$ php artisan countries:migration

It will generate the <timestamp>_setup_countries_table.php migration and the CountriesSeeder.php seeder. To make sure the data is seeded insert the following code in the seeds/DatabaseSeeder.php

$this->call('CountriesSeeder'); 

You may now run the migration including the seed.

$ php artisan migrate --seed

After running this command the filled countries table will be available.