urban-brussels/nova-api

Nova API 的 PHP 封装。Nova 是布鲁塞尔首都大区的共享 IT 平台,致力于规划许可、土地分割许可和环保许可证的文件管理。

0.8.2 2023-01-05 08:53 UTC

This package is auto-updated.

Last update: 2024-09-30 07:32:08 UTC


README

Nova API 的 PHP 封装。Nova 是布鲁塞尔首都大区的共享 IT 平台,致力于规划许可、土地分割许可和环保许可证的文件管理。许可申请可以在 OpenPermits.brussels 上在线查看。

安装

composer require urban-brussels/nova-api

使用

use UrbanBrussels\NovaApi\Attribute;
use UrbanBrussels\NovaApi\PermitQuery;
use UrbanBrussels\NovaApi\PermitCollection;

$query = new PermitQuery('PU'); // Create a query for planning (PU) or environmental (PE) licences
$permits = $query
    ->filterByAttributeArray(Attribute::REFERENCE_NOVA, ['04/PFD/1796029', '04/PFD/1795271']) // Filter by Nova References
    ->setOrder(Attribute::DATE_SUBMISSION, 'DESC') // Order by descending submission date
    ->setLimit(2) // Limit to 2 results
    ->getResults();

// You now have a PermitCollection object, that can be used in a loop
foreach ($permits->getPermits() as $permit) 
{
    echo $permit->getReferenceNova();
    echo $permit->getAddress();
    echo $permit->getDateInquiryEnd();
    echo $permit->hasActiveInquiry();
}

// Other available getters

// Get Address in an array (street name FR/NL, street number, municipality FR/NL)
$permit->getAddress();

// Get Type and Subtype
$permit->getType();
$permit->getSubtype();

// Get an array of Links related to this permit request (Nova, OpenPermits, Nova API)
$permit->getLinks();

// Get Description of the requested permit, in an array FR/NL
$permit->getObject();

// Get Public inquiry dates
$permit->getDateInquiryBegin();
$permit->getDateInquiryEnd();

// Get Submission Date
$permit->getDateSubmission();

// Get Notification Date
$permit->getDateNotification();

// Get a multidimensional array with the Area Typology (existing, projected, authorized areas for each type)
$permit->getAreaTypology();

// Submission language (FR or NL)
$permit->getLanguage();

其他查询示例

use UrbanBrussels\NovaApi\PermitQuery;
use UrbanBrussels\NovaApi\PermitCollection;

$query = new PermitQuery('PU');

// Retrieve all requests in public inquiry for the date 2022-01-01 (PU for planning requests, PE for environmental requests)
$permits = $query->filterByInquiryDate('2022-01-01')
                 ->getResults();

// Filters can be combined
$permits = $query->filterByAttribute(Attribute::STREETNAME_FR, 'Rue de Dublin') // First filter to limit by street
                 ->filterByAttribute(Attribute::LANGUAGE, 'NL'); // Second filter to limit to applications in Dutch
                 ->getResults();

// If you use a raw cql_filter, you can query what you want (e.g. every permit request for a given Street + Zipcode)    
$permits = $query->filterByRawCQL("streetnamefr = 'Rue de Dublin' AND zipcode='1050'" )
                 ->getResults();

优点

此库修复了 Nova WFS Web 服务中的以下不一致性

  • PE 和 PU 的属性名称不同
  • 属性名称混合法语和英语
  • 不同的 DateTime 格式(带或不带微秒)
  • 布尔值作为字符串返回(例如:事件,mpp)
  • 暂停的 JSON 过于深层
  • 整数值作为字符串返回(例如:novaseq,邮编)
  • 状态必须通过混合不同的属性来猜测
  • 冗余
  • 不正确的值(例如:1111 年的提交)
  • 地址中的“至”号与“从”号相同