mnavarrocarter/countries

此包已被弃用,不再维护。没有建议替代包。

一个用于以面向对象的方式处理国家的库

dev-master 2018-09-04 18:38 UTC

This package is auto-updated.

Last update: 2020-11-20 12:25:36 UTC


README

一个PHP库,用于将国家信息作为对象处理,数据来源于https://restcountries.eu/

安装

安装通过composer完成

composer require mnavarrocarter/countries

使用

国家检索器

国家仓库接口

国家集合对象

Doctrine集成

此库包含一个实现CountryRepository的Doctrine仓库以及为组成国家聚合根的不同对象提供的Doctrine映射。

Symfony包配置

此库还可以作为Symfony包使用。您几乎可以自定义库的各个方面,例如定义默认的仓库以及配置其他选项,如缓存。

mnc_countries:
    repository:
        # Alias to the interface
        default: mnc_countries.in_memory_repository
        # If true, the default one will be DoctrineCountryRepository
        use_doctrine: true
    fetcher:
        # Alias to the interface
        default: mnc_countries.object_fetcher
        # If true, the default one will be CacheCountryFectherDecorator
        use_cache_decorator: true
        # Cache service id. Redis is pretty efficient.
        cache: Psr\SimpleCache\CacheInterface