exertis/yii2-experian-qas
Composer 安装命令:
composer require exertis/yii2-experian-qas
包简介
Experian QAS Pro On Demand Postocde lookup SOAP service integration for the Yii framework. See also http://support.qas.com/experian_qas_pro_ondemand__php_only__technical_update_2021.htm
README 文档
README
Packaging Experian QAS Pro On Demand for Yii2 and Packagist
Rough Usage Example
This example is based on the Yii2 Framework, hence \Yii::$app->params['qas.username'] and \Yii::$app->params['qas.password'] will yield username and password from the Yii parameters file.
This example performs the setup and search.
define("CONTROL_WSDL_URN", "https://your.wsdl.storage/ProOnDemandService.wsdl"); $qas = new \exertis\experianqas\QuickAddress(CONTROL_WSDL_URN); if (empty($qas)) { throw new Exception('QAS: Initial connection failed'); } $qas->setQASCredentials(\Yii::$app->params['qas.username'], \Yii::$app->params['qas.password']); // Find out available DataSets $aDataSets = $qas->getAllDataSets(); $sPromptSet = $qas->getPromptSet('GBR'); $layouts = $qas->getAllLayouts('GBR'); # Perform the initial search (singleline engine, flattened picklists) $qas->setEngineType(QAS_SINGLELINE_ENGINE); $qas->setFlatten(TRUE); $picklist = $qas->searchSingleline('GBR', [$postcode], 'Optimal');
The result is a 'picklist' which you could process as follows:
if (!empty($picklist->atItems) && is_array($picklist->atItems)) { // loop through each possible matched address $addresses = []; foreach ($picklist->atItems as $atItem) { //$formattedAddress = $qas->getFormattedAddress('QADefault', $atItem->Moniker); $formattedAddress = $qas->getFormattedAddress('FullPAF', $atItem->Moniker); // FormattedAddress $address = [ 'picklistvalue' => $atItem->Picklist, 'flatNumber' => $formattedAddress->atAddressLines[5]->Line, // Sub-building name 'houseName' => $formattedAddress->atAddressLines[7]->Line, // Building name 'houseNumber' => $formattedAddress->atAddressLines[8]->Line, // Building number 'streetName' => $formattedAddress->atAddressLines[15]->Line, // Thoroughfare 'locality' => $formattedAddress->atAddressLines[18]->Line, // Dependent locality 'town' => $formattedAddress->atAddressLines[20]->Line, // Town 'county' => $formattedAddress->atAddressLines[21]->Line, // County 'id' => $atItem->Moniker, ]; $addresses[] = $address; } // foreach
统计信息
- 总下载量: 17
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: BSD-3-Clause
- 更新时间: 2015-02-24