PHP code example of aheenam / countries

1. Go to this page and download the library: Download aheenam/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/ */

    

aheenam / countries example snippets


// config/app.php
'providers' => [
    // ...
    Aheenam\Countries\CountriesServiceProvider::class,
];

// config/app.php
'aliases' => [
    // ...
    'Countries' => \Aheenam\Countries\Facades\Countries::class,
];



Countries::all();


App::setLocale('en'):
$countries = Countries::allIn();
$countries->get('en'); // returns a collection with all countries in English


App::setLocale('en'):
Countries::get('de'); // returns "Germany"


App::setLocale('en'):
Countries::get('de', 'de'); // returns "Deutschland"