use CommerceGuys\Country\Country; // Create a new instance of the Country class $country = new Country('US'); // Get the country name $countryName = $country->getName(); // Get the currency code $currencyCode = $country->getDefaultCurrencyCode();
use CommerceGuys\Country\CountryManager; // Create a new instance of the CountryManager class $countryManager = new CountryManager(); // Get all countries $countries = $countryManager->getList(); // Loop through all countries and print their names foreach ($countries as $countryCode => $countryName) { echo $countryName . "\n"; }In this example, we create a new instance of the `CountryManager` class and retrieve a list of all countries using the `getList()` method. We then loop through each country and print its name. Overall, PHP Country is a useful package library for developers who need to work with country data within their PHP applications.