daandesmedt / phpcrab
PHP封装的弗拉芒CRAB(中央参考地址簿)SOAP Web服务(WS & 工具)
Requires
- php: >=7.1
- ext-soap: *
- daandesmedt/phpwktadapter: ^1.0
Requires (Dev)
This package is auto-updated.
Last update: 2024-09-27 02:51:49 UTC
README
"CRAB"这个缩写代表“中央参考目录”。CRAB是弗拉芒(比利时)地址的官方来源。它包含所有官方地址及其地理位置。它由弗拉芒城市和市政机构管理。使用CRAB是免费的,对每个人开放。
CRAB包含在弗拉芒基本登记制度中。在这种情况下,CRAB将演变为地址登记。这包括数据模型调整和新服务的建设。我们将逐步淘汰现有的CRAB服务和工具,并用新的全球建筑和地址登记服务来替代它们。您可以在建筑登记产品的页面上找到更多关于此的信息。
PHPCRAB提供了一组围绕开放的CRAB WS SOAP服务和CRAB Tools SOAP服务的简单使用辅助类。
CRAB WS 和 CRAB Tools
WS-CRAB
WS-CRAB公开CRAB实体子集的信息;提供三种类型的操作
- 列出XXX:基于零个或一个参数列出实体;域值列表;
- 查找XXX:根据一个或多个可能包含通配符的参数搜索实体;
- 获取XXX:请求单个实体的详细信息。
CRAB Tools
CRAB Tools服务包含帮助方法,可以在CRAB中的数据之上解锁转换逻辑。该服务可用于清理您的地址文件并为其添加地理信息。
安装
通过composer安装包
composer require daandesmedt/phpcrab
确保在您的代码库中包含composer的自动加载器。
CRAB WS操作
WS-CRAB公开CRAB实体子集的信息;提供三种类型的操作
- 列出XXX:基于零个或一个参数列出实体;域值列表;
- 查找XXX:根据一个或多个可能包含通配符的参数搜索实体;
- 获取XXX:请求单个实体的详细信息。
WSCRAB (daandesmedt\CRAB\ws\WSCRAB)支持以下特定操作
findGemeenten($gemeenteNaam, $gewestId)findGemeentenByPostkanton($postkantonCode)findHuisnummers($huisnummer, $straatnaamId)findHuisnummersWithStatus($huisnummer, $straatnaamId)findStraatnamen($straatnaam, $gemeenteId)findStraatnamenWithStatus($straatnaam, $gemeenteId)findSubadressen($subadres, $huisnummerId)findSubadressenWithStatus($subadres, $huisnummerId)getAdrespositieByAdrespositieId($adrespositieId)getGebouwByIdentificatorGebouw($identificatorGebouw)getGemeenteByGemeenteId($gemeenteId)getGemeenteByGemeenteNaam($gemeenteNaam, $gewestId)getGemeenteByNISGemeenteCode($NISGemeenteCode)getGewestByGewestIdAndTaalCode($gewestId, $taalCode)getHuisnummerByHuisnummer($huisnummer, $straatnaamId)getHuisnummerByHuisnummerId($huisnummerId)getHuisnummerWithStatusByHuisnummer($huisnummer, $straatnaamId)getHuisnummerWithStatusByHuisnummerId($huisnummerId)getPerceelByIdentificatorPerceel($identificatorPerceel)getPostadresByHuisnummerId($huisnummerId)getSubadresBySubadresId($subadresId)getSubadresWithStatusBySubadresId($subadresId)getTerreinobjectByIdentificatorTerreinobject($identificatorTerreinobject)getWegobjectByIdentificatorWegobject($identificatorWegobject)getWegsegmentByIdentificatorWegsegment($identificatorWegsegment)listAardAdressenlistAardGebouwen()listAardSubAdressen()listAardTerreinobjecten()listAardWegobjecten()listAdrespositiesByHuisnummer($huisnummer, $straatnaamId)listAdrespositiesByHuisnummerId($huisnummerId)listAdrespositiesBySubadres($subadres, $huisnummerId)listAdrespositiesBySubadresId($subadresId)listBewerkingen()listGebouwenByHuisnummer($huisnummer, $straatnaamId)listGebouwenByHuisnummerId($huisnummerId)listGemeentenByGewestId($gewestId)listGeometriemethodeGebouwen()listGeometriemethodeWegsegmenten()listGewesten()listHerkomstAdresposities()listHuisnummersByIdentificatorTerreinobject($identificatorTerreinobject)listHuisnummersByStraatnaamId($straatnaamId)listHuisnummersWithStatusByIdentificatorGebouw($identificatorGebouw)listHuisnummersWithStatusByIdentificatorPerceel($identificatorPerceel)listHuisnummersWithStatusByIdentificatorTerreinobject($identificatorTerreinobject)listHuisnummersWithStatusByRijksregisterAdresId($rijksregisterAdresId)listHuisnummersWithStatusByStraatnaamId($straatnaamId)listOrganisaties()listPercelenByHuisnummer($huisnummer, $straatnaamId)listPercelenByHuisnummerId($huisnummerId)listPostadressenByStraatnaamId($straatnaamId)listPostkantonsByGemeenteId($gemeenteId)listRijksregisterAdresByHuisnummer($huisnummer, $straatnaamId)listRijksregisterAdresBySubadresId($subadresId)listRijksregisterStratenByStraatnaamId($straatnaamId)listStatusGebouwen()listStatusHuisnummers()listStatusStraatnamen()listStatusSubadressen()listStatusWegsegmenten()listStraatnamenByGemeenteId($gemeenteId)listStraatnamenByIdentificatorWegobject($identificatorWegobject)listStraatnamenWithStatusByGemeenteId($gemeenteId)listStraatnamenWithStatusByIdentificatorWegobject($identificatorWegobject)listStraatnamenWithStatusByIdentificatorWegsegment($identificatorWegsegment)listSubadressenByHuisnummerId($huisnummerId)listSubadressenWithStatusByHuisnummerId($huisnummerId)listSubadressenWithStatusByRijksregisterAdresId($rijksregisterAdresId)listTalen()listTerreinobjectenByHuisnummerId($huisnummerId)listWegobjectenByStraatnaamId($straatnaamId)listWegsegmentenByStraatnaamId($straatnaamId)
示例
<?php require __DIR__ . '/../vendor/autoload.php'; use daandesmedt\CRAB\CRAB; use daandesmedt\CRAB\ws\WSCRAB; $wscrab = new WSCRAB(); $res = $wscrab->listAardAdressen(); var_dump($res);
CRAB 工具操作
CRAB Tools服务包含帮助方法,可以在CRAB中的数据之上解锁转换逻辑。该服务可用于清理您的地址文件并为其添加地理信息。
CRABTools (daandesmedt\CRAB\tools\CRABTools) 支持以下特定操作
getAddressLocation():查找CRAB地址的(已知或计算出的)地形位置getStreetLocation():查找CRAB街道的对应位置getCRABMatch(boxNumber, cityName, houseNumber, nisCity, postalCode, rrStreetCode, streetName):查找给定地址的对应CRAB地址
示例
<?php require __DIR__ . '/../vendor/autoload.php'; use daandesmedt\CRAB\tools\CRABTools; $crabtools = new CRABTools(); $res = $crabtools->getAddressLocation(10); var_dump($res);
处理CRAB服务异常
CRAB WS 服务异常(SOAP错误)会导致CRABServiceException。
<?php require __DIR__ . '/../vendor/autoload.php'; use daandesmedt\CRAB\CRAB; use daandesmedt\CRAB\ws\WSCRAB; $wscrab = new WSCRAB(); try { $res = $wscrab->getWegsegmentByIdentificatorWegsegment('124384'); } catch (CRABServiceException $e) { var_dump($e->getMessage()); }
示例代码
示例代码可以在examples文件夹中找到。