Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/baraja-core/country
Country management package with Doctrine entities and flag (🏳️🌈) support.
https://github.com/baraja-core/country
country country-emoji country-flag country-management emoji-flag entity flag internationalization locale localization state
Last synced: 10 days ago
JSON representation
Country management package with Doctrine entities and flag (🏳️🌈) support.
- Host: GitHub
- URL: https://github.com/baraja-core/country
- Owner: baraja-core
- License: mit
- Created: 2021-03-02T16:32:13.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2024-07-10T04:49:47.000Z (4 months ago)
- Last Synced: 2024-10-11T21:20:04.921Z (about 1 month ago)
- Topics: country, country-emoji, country-flag, country-management, emoji-flag, entity, flag, internationalization, locale, localization, state
- Language: PHP
- Homepage: https://php.baraja.cz
- Size: 260 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Funding: .github/funding.yml
- License: LICENSE
Awesome Lists containing this project
README
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
- FileCountryThe 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](http://country.io/data/) service to retrieve the data.
![Country table](doc/table.png)
Usage:
```php
$manager = new \Baraja\Country\CountryManager;
$manager->getByCode('CZ');
```Returns:
![Country entity](doc/entity.png)
🏳️🌈 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:
```php
$manager = new \Baraja\Country\CountryManager;
$country = $manager->getByCode('CZ');echo $country->getFlag(); // return 🇨🇿
```