Skip to content
A Zend Framework 2 module for country and subdivision data.
PHP
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src
tests
.gitignore
.scrutinizer.yml
.travis.yml
LICENSE
Module.php
README.md
composer.json
phpunit.xml

README.md

HtCountryModule

Master Branch Build Status Latest Stable Version Total Downloads Scrutinizer Code Quality Code Coverage

A Zend Framework 2 module for country and subdivision data. This module integrates lib-country with Zend Framework 2.

Requirements

Usage

Please read the docs of lib-country first.

Using Services

// From ServiceManager
/** @var Phine\Country\Loader\Loader $countryLoader */
$countryLoader = $serviceManager->get('CountryLoader');

Using hydrator strategy

$strategy = new HtCountryModule\Hydrator\Strategy\CountryStrategy;
// or $strategy = $serviceManager->get('HtCountryModule\Hydrator\Strategy\CountryStrategy');

/** @var Phine\Country\Country $country */
$country = $strategy->hydrate('US');

echo $strategy->extract($country); // will print US

Using country validator

$validator = new HtCountryModule\Validator\CountryValidator;
// or $validator = $serviceManager->get('ValidatorManager')->get('CountryValidator');
var_dump($validator->isValid('asdfasfd')); // bool(false)
var_dump($validator->isValid('US')); // bool(true)

Installation

  • Add "hrevert/ht-country-module": "1.0.*" to composer.json and run php composer.phar update
  • Register HtCountryModule as module in config/application.config.php
You can’t perform that action at this time.