nathandunn / laravel-countries
Requires
- php: ^8.1
- illuminate/bus: ^10.0
- illuminate/console: ^10.0
- illuminate/contracts: ^10.0
- illuminate/database: ^10.0
- illuminate/queue: ^10.0
- illuminate/support: ^10.0
- nathandunn/model-repositories: ^1.0.0
Requires (Dev)
- guzzlehttp/guzzle: ^7.4
- nunomaduro/collision: ^7.0
- nunomaduro/larastan: ^2.0
- orchestra/testbench: ^8.0.1
- phpstan/extension-installer: ^1.1
- phpstan/phpstan-deprecation-rules: ^1.0
- phpstan/phpstan-phpunit: ^1.0
- phpunit/phpunit: ^10.0
- spatie/laravel-ray: ^1.29
This package is auto-updated.
Last update: 2024-12-19 02:21:24 UTC
README
Laravel Countries provides database migrations and syncing capabilities in order to sync continents, currencies and currencies. The package uses the REST Countries API to maintain an up-to-date list of countries. This is in contrast to a lot of existing libraries, which rely on data stored in the repository and often becomes out-of-date.
Installation
You can install the package via Composer:
composer require nathandunn/laravel-countries
Once the package has been installed, run Laravel's migration command to create the base tables.
php artisan migrate
Syncing countries
Console command
The primary method of syncing companies is by running the following command:
php artisan countries:sync
This will fetch and sync data from the API.
Seeder
You may find you'd like to add syncing countries as part of your development/staging environment. You may add NathanDunn\Countries\Database\Seeders\CountrySeeder
to your DatabaseSeeder
.
<?php namespace Database\Seeders; use Illuminate\Database\Seeder; use NathanDunn\Countries\Database\Seeders\CountrySeeder; class DatabaseSeeder extends Seeder { /** * Run the database seeders. * * @return void */ public function run() { $this->call(CountrySeeder::class); } }