Skip to content

Automatically updated country data containing ISO codes and English country names, powered by free MaxMind data.

License

Notifications You must be signed in to change notification settings

brightnucleus/country-codes

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Bright Nucleus Country Codes Database

Latest Stable Version Total Downloads Latest Unstable Version License

This is a Composer plugin that provides an automated version of the free MaxMind GeoLite CSV Country Codes database.

The main advantage is that the downloaded database will be checked for updates on each composer install and composer update.

Table Of Contents

Attribution

This product includes GeoLite Legacy data created by MaxMind, available from http://www.maxmind.com.

Installation

The only thing you need to do to make this work is adding this package as a dependency to your project:

composer require brightnucleus/country-codes

Basic Usage

On each composer install or composer update, a check will be made to see whether there's a new version of the database available. If there is, that new version is downloaded.

Usage is pretty straight-forward. Just use one of the two provided static methods:

<?php

use BrightNucleus\CountryCodes\Country;

// Get the name from an ISO 3166 country code.
$name = Country::getNameFromCode( 'US' ); // Returns 'United States'.

// Get the ISO 3166 country code from a country name.
$code = Country::getCodeFromName( 'United States' ); // Returns 'US'.

Contributing

All feedback / bug reports / pull requests are welcome.

License

This code is released under the MIT license.

For the full copyright and license information, please view the LICENSE file distributed with this source code.

About

Automatically updated country data containing ISO codes and English country names, powered by free MaxMind data.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages