承接 php-extended/php-api-fr-insee-cog-object 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

php-extended/php-api-fr-insee-cog-object

最新稳定版本:8.1.12

Composer 安装命令:

composer require php-extended/php-api-fr-insee-cog-object

包简介

A library that implements the php-api-fr-insee-cog-interface library

README 文档

README

A library that implements the php-api-fr-insee-cog-interface library.

This library makes insee Official Geographic Code (COG) available as objects to populate a database. The COG is available at the url : https://www.insee.fr/fr/information/2560452.

coverage build status

Last Updated Date : 2020-09-27

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.phar from their website.
  • Then run the following command to install this library as dependency :
  • php composer.phar php-extended/php-api-fr-insee-cog-object ^8

Basic Usage

This library gives an unique endpoint : \PhpExtended\Insee\InseeCogEndpoint from which all data can be retrieved.

  • For retrieving pays, you may use :

$endpoint = new InseeCogEndpoint();
$paysIterator = $endpoint->getPaysIterator($endpoint->getMaximumAvailableYear());
foreach($paysIterator as $pays)
{
	// @var $pays \PhpExtended\Insee\InseeCogPaysInterface
}

If you want all the pays by year, do :


$endpoint = new InseeCogEndpoint();
foreach($year = $endpoint->getMinimumAvailableYear(); $year <= $endpoint->getMaximumAvailableYear(); $year++)
{
	foreach($endpoint->getPaysIterator($year) as $pays)
	{
		// @var $pays \PhpExtended\Insee\InseeCogPaysInterface
	}
}

  • For retrieving regions, you may use :

$endpoint = new InseeCogEndpoint();
$regionIterator = $endpoint->getRegionIterator($endpoint->getMaximumAvailableYear());
foreach($regionIterator as $region)
{
	// @var $region \PhpExtended\Insee\InseeCogRegionInterface
}

If you want all the regions by year, do :


$endpoint = new InseeCogEndpoint();
foreach($year = $endpoint->getMinimumAvailableYear(); $year <= $endpoint->getMaximumAvailableYear(); $year++)
{
	foreach($endpoint->getRegionIterator($year) as $region)
	{
		// @var $region \PhpExtended\Insee\InseeCogRegionInterface
	}
}

  • For retrieving departements, you may use :

$endpoint = new InseeCogEndpoint();
$departementIterator = $endpoint->getDepartementIterator($endpoint->getMaximumAvailableYear());
foreach($departementIterator as $departement)
{
	// @var $departement \PhpExtended\Insee\InseeCogDepartementInterface
}

If you want all the departements by year, do :


$endpoint = new InseeCogEndpoint();
foreach($year = $endpoint->getMinimumAvailableYear(); $year <= $endpoint->getMaximumAvailableYear(); $year++)
{
	foreach($endpoint->getDepartementIterator($year) as $departement)
	{
		// @var $departement \PhpExtended\Insee\InseeCogDepartementInterface
	}
}

  • For retrieving arrondissements, you may use :

$endpoint = new InseeCogEndpoint();
$arrondissementIterator = $endpoint->getArrondissementIterator($endpoint->getMaximumAvailableYear());
foreach($arrondissementIterator as $arrondissement)
{
	// @var $arrondissement \PhpExtended\Insee\InseeCogArrondissementInterface
}

If you want all the arrondissements by year, do :


$endpoint = new InseeCogEndpoint();
foreach($year = $endpoint->getMinimumAvailableYear(); $year <= $endpoint->getMaximumAvailableYear(); $year++)
{
	foreach($endpoint->getArrondissementIterator($year) as $arrondissement)
	{
		// @var $arrondissement \PhpExtended\Insee\InseeCogArrondissementInterface
	}
}

  • For retrieving cantons, you may use :

$endpoint = new InseeCogEndpoint();
$cantonIterator = $endpoint->getCantonIterator($endpoint->getMaximumAvailableYear());
foreach($cantonIterator as $canton)
{
	// @var $canton \PhpExtended\Insee\InseeCogCantonInterface
}

If you want all the cantons by year, do :


$endpoint = new InseeCogEndpoint();
foreach($year = $endpoint->getMinimumAvailableYear(); $year <= $endpoint->getMaximumAvailableYear(); $year++)
{
	foreach($endpoint->getCantonIterator($year) as $canton)
	{
		// @var $canton \PhpExtended\Insee\InseeCogCantonInterface
	}
}

  • For retrieving communes, you may use :

$endpoint = new InseeCogEndpoint();
$communeIterator = $endpoint->getCommuneIterator($endpoint->getMaximumAvailableYear());
foreach($communeIterator as $commune)
{
	// @var $commune \PhpExtended\Insee\InseeCogCommuneInterface
}

If you want all the communes by year, do :


$endpoint = new InseeCogEndpoint();
foreach($year = $endpoint->getMinimumAvailableYear(); $year <= $endpoint->getMaximumAvailableYear(); $year++)
{
	foreach($endpoint->getCommuneIterator($year) as $commune)
	{
		// @var $commune \PhpExtended\Insee\InseeCogCommuneInterface
	}
}

  • For retrieving commune events, you may use :

$endpoint = new InseeCogEndpoint();
foreach($endpoint->getEventCommuneIterator($year) as $event)
{
	// @var $event \PhpExtended\Insee\InseeCogEventCommuneInterface
}

License

统计信息

  • 总下载量: 12.12k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 1
  • 依赖项目数: 2
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-09-06