hrevert / ht-country-module
A Zend Framework 2 module for country and subdivision data.
1.0.1
2014-11-21 15:32 UTC
Requires
- php: >=5.4
- phine/country: ~1.0
Requires (Dev)
Suggests
- zendframework/zend-modulemanager: If you want to use it as a Zend Framework 2 module
- zendframework/zend-servicemanager: To use the services provided by this module
- zendframework/zend-stdlib: To use hydrator strategy provided by this module
- zendframework/zend-validator: If you want to use it as a country validator
This package is auto-updated.
Last update: 2024-11-13 02:52:21 UTC
README
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 runphp composer.phar update
- Register
HtCountryModule
as module inconfig/application.config.php