PHP code example of thecoder / world

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

    

thecoder / world example snippets


TheCoder\World\WorldServiceProvider::class,

use World;

$continents = World::continents()->get();  // Get all continents
$countries = World::countries()->get();  // Get all countries

use TheCoder\World;

$world = new World();

$continents = $world->continents()->get();  
$countries = $world->countries()->get();  

$location = World::byId(1)->first();

$location = World::byEnglishName('Asia')->first();

$locations = World::byIds([1,2])->get();

$locations = World::byEnglishNames(['Iraq', 'Iran'])->get();

$location = World::count();  

$asia = World::continents('Asia')->first();

$asia = World::continents()->byEnglishName('Asia')->first();  

$asiaCountries = World::continents()->byEnglishName('Asia')->countries()->get();  

$iranProvinces = World::countries('Iran')->provinces()->get();

$iranProvinces = World::countries()->byEnglishName('Iran')->provinces()->get();

$gilanCities = World::provinces('Gilan')->cities()->get();  
  
$gilanCities = World::provinces()->byEnglishName('Gilan')->cities()->get();  

  'cache' => [
      'enabled' => true,
      'prefix' => 'thecoder-world-',
      'tag' => 'thecoder-world',
      'ttl' => null, // Store cache forever
  ],

World::clearCache();

use World;

$continents = World::continents()->get();

World::continents('Europe')->countries()->get();

World::provinces('California')->cities()->get();
sh
php artisan vendor:publish --provider="TheCoder\World\WorldServiceProvider"
sh
php artisan migrate
sh
php artisan world:seed
 config/world.php 
bash
  php artisan cache:clear