PHP code example of ayoub-amzil / offline-globe

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

    

ayoub-amzil / offline-globe example snippets


use offline\Globe; 

$globe = new Globe();

$globe->Countries()

$globe->African()

$globe->Asian()

$globe->Australia()

$globe->Europe()

$globe->NorthAmerica()

$globe->SouthAmerica()

$globe->Code('Morocco') // MA (return type: string)

$globe->Capital('japan') // Tokyo (return type: string)

$globe->Language('jamaica') // ['english', 'jamaican_patois'] (return type: array)

// It can take only the country (mandatory)
$globe->Currency('Canada') // ['name' => 'Canadian Dollar', 'code' => 'CAD'] (return type: array)

// Or the country plus one type of information
// name (option)
$globe->Currency('canada','name') // Canadian Dollar (return type: string)
// code (option)
$globe->Currency('canada','code') // CAD (return type: string)

// country (mandatory)
return view('welcome',
            ['flag'=>$globe->flag('united states')]
        ); //  (return type: string)

// In your template
<img src="{{$flag}}" alt="image">

// type (option) [default=svg]
return view('welcome',
            ['flag'=>$globe->flag('united states','png')]
        ); //  (return type: string)

// In your template
<img src="{{$flag}}" alt="image">

// directory name (option) [default=flags]
// PS:  if you want to change your directory name, you have to set the type before
return view('welcome',
            ['flag'=>$globe->flag('united states','png','images')]
        ); //  (return type: string)

// In your template
<img src="{{$flag}}" alt="image">