php-extended / php-insee-sirene-bulk-api
此包已被废弃,不再维护。作者建议使用php-extended/php-api-fr-insee-sirene-object包。
一个Sirene批量导出的php API包装器,以便将数据作为php对象提供。
3.1.3
2020-11-22 14:09 UTC
Requires
- php: >=7.1
- ext-zip: *
- php-extended/php-enumerable: ^3
- php-extended/polyfill-php80-stringable: ^1
- psr/http-client: ^1
- psr/http-factory: ^1
- psr/log: ^1
Requires (Dev)
README
一个Sirene批量导出的php API包装器,以便将数据作为php对象提供。源数据可在以下URL获取:https://www.data.gouv.fr/fr/datasets/base-sirene-des-entreprises-et-de-leurs-etablissements-siren-siret。
安装
此库的安装通过composer完成。从他们的网站下载composer.phar
。然后将其添加到你的composer.json文件中
"require": {
...
"php-extended/php-insee-sirene-bulk-api": "^3"
...
}
然后运行php composer.phar update
以安装此库。此库中所有类的自动加载都通过composer的自动加载器完成。
基本用法
use PhpExtended\Insee\InseeSireneBulkEndpoint;
/* @var $client \Psr\Http\Client\ClientInterface */
/* @var $uriFactory \Psr\Http\Message\UriFactoryInterface */
/* @var $requestFactory \Psr\Http\Message\RequestFactoryInterface */
/* @var $tempPath string */
$endpoint = new InseeSireneBulkEndpoint($client, $uriFactory, $requestFactory, $tempPath);
foreach($endpoint->getLatestStockUniteLegaleIterator() as $uniteLegale)
{
// @var $uniteLegale \PhpExtended\Insee\InseeSireneBulkEndpoint */
}
$endpoint->cleanupLatestStockUniteLegaleFile();
// The same is possible with the following files :
$endpoint->getLatestStockUniteLegaleHistoricIterator();
// and its cleanup :
$endpoint->cleanupLatestStockUniteLegaleHistoricFile();
// for the stock etablissement :
$endpoint->getLatestStockEtablissementIterator();
$endpoint->cleanupLatestStockEtablissementFile();
// for the etablissement historic :
$endpoint->getLatestStockEtablissementHistoricIterator();
$endpoint->cleanupLatestStockEtablissementHistoricFile();
// for the etablissement dependancies :
$endpoint->getLatestStockEtablissementDependancyIterator();
$endpoint->cleanupLatestStockEtablissementDependancyFile();