PHP code example of eliseekn / countries-helper

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

    

eliseekn / countries-helper example snippets


//In your controller
$countries = CountriesHelper::getAll();

//In your blade file
<label for="country" class="form-label">Select country</label>
<select name="country" id="country" class="form-select">
    @foreach($countries as $country)
    @if (!is_null($country))
        @foreach($country as $key => $value)<option value="{{ $key }}">{{ $value }}</option>@endforeach
    @endif
    @endforeach
</select>