The DeydeDataQBundle adds support for the deyde data quality services. In this version only supports the address normalization service.
- Download DeydeDataQBundle
- Enable the Bundle
Run the following composer require command:
$ php composer.phar require deyde/dataqbundle:dev-master
Finally, enable the bundle in the kernel:
<?php
// app/AppKernel.php
public function registerBundles()
{
$bundles = array(
// ...
new Deyde\DataQBundle\DeydeDataQBundle(),
);
}You will have to set your basic configuration to use de deyde services.
# app/config/config.yml
deyde_address_validation:
deyde_user: test
deyde_password: passwordWhere desde_user is your deyde user account and deyde_password is your account password.
Note: deyde_user and deyde_password are the only required configuration params.
deyde_address_validation:
deyde_user: test
deyde_password: password
proxy:
address: ip_machine:port
user: proxy_user
password: proxy_passNote: use this configuration when you are behind a proxy.
If Deyde changes their services host there's not problem. It's possible to change this via configuration file.
deyde_address_validation:
deyde_user: test
deyde_password: password
deyde_base_url: https://deyde.es/Note: by default, the url is https://ws.deyde.com.es/
If Deyde changes the address validation service url there's not problem. It's possible to change this via configuration file.
_deyde_address_validation:
deyde_user: test
deyde_password: password
address_validation_service_url: deyde-autoCompletion/domicilio-nuevoNote: by default, the url is deyde-autoCompletion/domicilio
The product list parameter determines what kind of products are selected.
By deafult its value is 'es,dom,cod'. You can change its value via configuration file.
deyde_address_validation:
deyde_user: test
deyde_password: password
product_list_parameter: pt,dom,codNote: At this moment 'es,dom,cod' and 'pt,dom,cod' values are supported.
Finally we show a complete configuration file, fully overwritten its values.
deyde_address_validation:
deyde_user: test
deyde_password: password
deyde_base_url: https://ws.deyde.com.es/
address_validation_service_url: deyde-autoCompletion/domicilio
product_list_parameter: es,dom,cod
proxy:
address: ip_machine:port
user: proxy_user
password: proxy_passservice = $this->get('deyde_address_validation_service');
$service->validateAddress("Calle mayor 2 2800 madrid");The most commond response is like follows:
{
"codigoPoblacion" : "28079000000",
"codigoPostal" : "28013",
"codigoVia" : "2807903981",
"indicadorDyf" : "4",
"indicadorEstadoCodificacion" : "F",
"indicadorEstadoFiabilidad" : "7",
"mujeres" : 1712655,
"municipio" : "MADRID",
"nombreVia" : "MAYOR",
"numeroVia" : "0002",
"poblacion" : "MADRID",
"provincia" : "MADRID",
"restoVia" : "",
"tipoVia" : "",
"varones" : 1494592
}Note:In case that Deyde service is down, the bundle throws a ServiceNotAvalaibleException.
Test are under DeydeDataQBundle/test directory. Launch them is simple, just run the next command from DeydeDataQBundle/test directory:
phpunit --bootstrap bootstrap.php Deyde/Tests/DeydeAddressValidatorTest