php-extended/php-api-fr-insee-ban-object
Composer 安装命令:
composer require php-extended/php-api-fr-insee-ban-object
包简介
A library that implements the php-extended/php-api-fr-insee-ban-interface library
README 文档
README
A library that implements the php-extended/php-api-fr-insee-ban-interface library.
This library makes a collaborative work of the ApiFrInsee, Dgfip, OpenStreetMap Contributors, La Poste and Etalab ; known as the BAN (Base des Adresses Nationale) available as objects to populate a database. The BAN is available at the url : https://adresse.data.gouv.fr/.
Installation
The installation of this library is made via composer and the autoloading of all classes of this library is made through their autoloader.
- Download
composer.pharfrom their website. - Then run the following command to install this library as dependency :
php composer.phar php-extended/php-api-fr-insee-ban-object ^9
Basic Usage
This library gives an unique endpoint : \PhpExtended\Insee\InseeCogEndpoint
from which all data can be retrieved.
- For most usages, you may use the following code :
use PhpExtended\Insee\InseeBanEndpoint;
use PhpExtended\Endpoint\GzipHttpEndpoint;
use PhpExtended\Endpoint\HttpEndpoint;
/** $client \Psr\Http\Client\ClientInterface */
$endpoint = new ApiFrInseeBanEndpoint(new GzipHttpEndpoint(new HttpEndpoint($client)));
$lastDateTime = $endpoint->getLatestDate();
$departements = $endpoint->getDepartementIds($lastDateTime);
foreach($departements as $departement)
{
$banLineIterator = $endpoint->getBanLinesIterator($lastDateTime, $departement);
foreach($banLineIterator as $banLine)
{
/** @var $banLine \PhpExtended\Insee\InseeBanLine */
// do something with the ban line representing :
// - a commune with CodeInsee and NomCommune
// - a group (street) with Id, NomVoie and NomComplementaire
// - an address with Id, Numero, Suffixe, CodePostal
// - a position with Id, X, Y, Lat, Lon
// - and generic data like type of localisation,
// source and date of last update
}
}
Be wary that the client must follow a certain number of rules regarding the
handling of files via the X-Php-Download-File request and response
headers for the GzipHttpEndpoint to be able to unzip the downloaded
file without having to use gigabytes of memory. It must also return an
X-Request-Uri header to get the full uri back.
For an example of the minimal needed http client, look at the
InseeBanEndpointTest class file and find the client that is used.
If you have that much memory however, you can bypass the GzipHttpEndpoint
and all of the X-Php-Download-File and X-Request-Uri shenanigans
altogether.
License
The code is under MIT (See license file).
php-extended/php-api-fr-insee-ban-object 适用场景与选型建议
php-extended/php-api-fr-insee-ban-object 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 10.23k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2020 年 11 月 29 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「php」 「api」 「object」 「base」 「implementation」 「ban」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 php-extended/php-api-fr-insee-ban-object 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 php-extended/php-api-fr-insee-ban-object 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 php-extended/php-api-fr-insee-ban-object 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A set of useful PHP classes.
Runn Me! Value Objects Library
Laravel SDK mapping data in object
A PSR-7 compatible library for making CRUD API endpoints
CitaNZ's SilverStripe picture object and field for SilverStripe 4
Uses reflection to map XML to PHP objects.
统计信息
- 总下载量: 10.23k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 17
- 依赖项目数: 3
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-11-29