Skip to content
Abdelrahman Omran edited this page Aug 20, 2016 · 5 revisions

Rinvex Country

Rinvex Country is a simple and lightweight package for retrieving country details with flexibility. A whole bunch of data including name, demonym, capital, iso codes, dialling codes, geo data, currencies, and other attributes for all 250 countries worldwide at your fingertips.

Packagist License VersionEye Dependencies Scrutinizer Code Quality Code Climate StyleCI SensioLabs Insight

Quick Example (TL;DR)

Install via composer require rinvex/country, then use as follows:

use Rinvex\Country\Models\Country;

// Find a country by it's ISO 3166-1 alpha-2
$egypt = (new Country)->find('EG');

// Find a country by one of it's attributes
$usa = (new Country)->findBy('capital', 'Washington D.C.');

// Find all countries
$countries = (new Country)->findAll();

// Retrieve only `name`, `demonym`, and `currency` attributes of "Japan":
$japan = (new Country)->find('JP', ['name', 'demonym', 'currency']);

// Utilize Laravel Collections to get an array of all country names, with their 'iso_3166_1_alpha2' as the array keys
(new Country)->findAll()->pluck('name.common', 'iso_3166_1_alpha2');

Mission accomplished! You're good to use this package right now! ✅

Unless you're new to this kind of stuff, you can skip the following steps! 😉


Clone this wiki locally