omisai / laravel-countries
A Laravel adapter for the countries package.
Requires
- php: ^8.2
- illuminate/support: ^11.0 || ^12.0 || ^13.0
- omisai/php-countries: ^1.4
Requires (Dev)
- laravel/pint: ^1.27
- orchestra/testbench: ^9.0 || ^10.0 || ^11.0
- pestphp/pest: ^4.3
This package is auto-updated.
Last update: 2026-03-22 20:07:09 UTC
README
Laravel adapter for omisai/php-countries. It registers the Omisai\Countries\Collection in the Laravel service container and exposes it through a facade.
Features
- Registers
Omisai\Countries\Collectionas a singleton in the container - Resolves the collection by class name or the
countriesbinding - Provides a
Countriesfacade - Supports Laravel 11, 12, and 13
Requirements
- PHP 8.2+
- Laravel 11, 12, or 13
Laravel 13 requires PHP 8.3+, which is enforced by Composer through Laravel's own package constraints.
Installation
Install the package via Composer:
composer require omisai/laravel-countries
Laravel package discovery will register the service provider and facade automatically.
Usage
Resolve the collection from the container:
use Omisai\Countries\Collection; $countries = app(Collection::class); $names = $countries->getCountriesName();
Resolve it by binding name:
$countries = app('countries');
Use the facade:
use Omisai\Laravel\Countries\Facades\Countries; $names = Countries::getCountriesName(); $hungary = Countries::getCountryByAlpha2('HU');
Testing
Run the test suite using Pest:
composer test
Contributing
Please see CONTRIBUTING.md for details on how to contribute to this project.
Security
Please see SECURITY.md for details on reporting security vulnerabilities.
License
This package is open-sourced software licensed under the MIT license.