PHP code example of lykegenes / laravel-countries
1. Go to this page and download the library: Download lykegenes/laravel-countries library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
lykegenes / laravel-countries example snippets
php
$country = \Countries::getByAlpha2Code('CA'); // 2-letters country code from ISO3166
$country = \Countries::getByAlpha3Code('CAN'); // 3-letters country code from ISO3166
$country = \Countries::getByNumericCode(124); // 3-digits country code from ISO3166
php
$country = \Countries::getByAlpha3Code('CAN');
$country->getAlpha2Code(); // 'CA'
$country->getAlpha3Code(); // 'CAN'
$country->getNumericCode(); // 124
$country->getOfficialName(); // 'Canada'
$country->getAttributes(); // An array of all the raw attributes.