country

A countries and flags library in PHP., (*1)
installation
Install via composer into your project:, (*2)
composer require delboy1978uk/country
usage
factory
You can call CountryFactory::generate($code) to create a country object, (*3)
public static function generate(string $id): Country;
entity
public function __toString();
public function getFlag(): string;
public function getId(): string;
public function getIso(): string;
public function getName(): string;
public function getNumCode(): int;
public function setFlag(string $flag): void;
public function setId(string $id): void
public function setIso(string $iso): void;
public function setName(string $name): void;
public function setNumCode(int $numCode): void;
public function toArray(): array;
trait
You can use HasCountryTrait to add a country to your object (also works with doctrine), (*4)
public function getCountry(): Country;
public function setCountry(Country $country): void;
flag image helper
You can call Flag::render($country, $size), where size can be one of tiny, small, medium, or large.
php
public static function render(Country $country, $size), (*5)