PHP code example of techguy / world-countries-api

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

    

techguy / world-countries-api example snippets


# run for auto discovery <-- If the package is not detected automatically -->
composer dump-autoload

php artisan vendor:publish --provider="World\Countries\WorldCountriesServiceProvider"

        /**
         * Seed the application's database.
         *
         * @return void
         */
        public function run()
        {
             // other seeds...
             $this->call(\World\Countries\Seeds\WorldCountriesTableSeeder::class);
        }

         /**
         * -------------------------------------
         * This is the sample data on how the
         * country data is stored in an object
         * -------------------------------------
         */
        {
        "id": "6ad0db80-c93b-11ea-9af5-bd4193f081f6",
        "name": "Kenya",
        "slug": "kenya",
        "data": {
            "flag": "https://restcountries.eu/data/ken.svg",
            "name": "Kenya",
            "capital": "Nairobi",
            "short2Code": "KE",
            "short3Code": "KEN",
            "callingCode": "254",
            "currencyCode": "KES",
            "currencyName": "Kenyan shilling"
        },
        "deleted_at": null,
        "created_at": "2020-07-18T21:12:42.000000Z",
        "updated_at": "2020-07-18T21:12:42.000000Z"
        }