baraja-core / country
Country manager.
Installs: 53 074
Dependents: 3
Suggesters: 0
Security: 0
Stars: 1
Watchers: 2
Forks: 0
Open Issues: 1
Requires
- php: ^8.0
- baraja-core/doctrine: ^3.0
- baraja-core/ecommerce-standard: ^0.0
Requires (Dev)
- baraja-core/plugin-system: ^2.0
- baraja-core/structured-api: ^3.0
- phpstan/extension-installer: ^1.1
- phpstan/phpstan: ^1.0
- phpstan/phpstan-deprecation-rules: ^1.0
- phpstan/phpstan-nette: ^1.0
- phpstan/phpstan-strict-rules: ^1.0
- roave/security-advisories: dev-master
- spaze/phpstan-disallowed-calls: ^3.1
README
BRJ organisation
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.
Usage:
$manager = new \Baraja\Country\CountryManager; $manager->getByCode('CZ');
Returns:
🏳️🌈 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 🇨🇿