Componette

Componette

baraja-core

baraja-core / country v1.0.7

Country management package with Doctrine entities and flag (๐Ÿณ๏ธโ€๐ŸŒˆ) support.

download-cloud-line composer require baraja-core/country

Country

Country management package.

Idea

This package provides an interface for working with countries. All countries always return as an entity that meets the Country interface. The specific implementation of the entity is decided by the package itself according to the available environment.

Possible implementations:

  • DoctrineCountry
  • FileCountry

The default country data is available in the json data file, according to which the data is subsequently updated.

Basic usage

The main control logic is in the CountryManager service, which provides communication and servicing of database entities.

The country information is stored in Doctrine entities, which are automatically generated on the first call based on a data file downloaded via the API.

We use the country.io service to retrieve the data.

Country table

Usage:

$manager = new \Baraja\Country\CountryManager;
$manager->getByCode('CZ');

Returns:

Country entity

๐Ÿณ๏ธโ€๐ŸŒˆ Flag support

The package fully supports the ability to get a country's flag as an emoji. To get it, simply call the method above the entity:

$manager = new \Baraja\Country\CountryManager;
$country = $manager->getByCode('CZ');

echo $country->getFlag(); // return ๐Ÿ‡จ๐Ÿ‡ฟ
bar-chart-fill

Statistics

download-cloud-fill
51451
star-fill
1
bug-fill
1
flashlight-fill
66d
price-tag-2-line

Badges

guide-fill

Dependencies

php (^8.0)
Componette Componette felix@nette.org