vldmir / laravel-iso3166
A Laravel wrapper for the league/iso3166 package.
v1.1.1
2024-10-11 16:20 UTC
Requires
- php: ^7.2|^8.0
- illuminate/support: ^7.0|^8.0|^9.0|^10.0
- league/iso3166: ^3.0
Requires (Dev)
- phpunit/phpunit: ^9.0
README
Laravel ISO3166 provides a convenient wrapper for the league/iso3166
library, allowing you to retrieve country information within your Laravel applications.
Installation
Install via Composer:
composer require vldmir/laravel-iso3166
If using Laravel <5.5, manually add service provider and facade:
'providers' => [ Vldmir\LaravelIso3166\Providers\CountryServiceProvider::class, ], 'aliases' => [ 'CountryService' => Vldmir\LaravelIso3166\Facades\CountryService::class, ],
Usage
use CountryService; // Retrieve country by name $country = CountryService::getByName('Canada'); echo $country->name; // Canada echo $country->alpha2; // CA // Retrieve country by alpha-2 code $country = CountryService::getByAlpha2('US'); echo $country->name; // United States of America // Retrieve country by numeric code $country = CountryService::getByNumeric('124'); echo $country->name; // Canada
Testing
Run tests using PHPUnit:
vendor/bin/phpunit
Changelog
Please see CHANGELOG for recent changes.
Contributing
Contributions are welcome! Please see CONTRIBUTING for details.
Security
If you discover any security issues, please email vld.romantsov@gmail.com.
Credits
License
The MIT License (MIT). Please see LICENSE for details.