php-extended / php-insee-sirene-bulk-api
This package is abandoned and no longer maintained.
The author suggests using the php-extended/php-api-fr-insee-sirene-object package instead.
A php API wrapper to the Sirene bulk exports to make the data available as php objects.
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
A php API wrapper to the Sirene bulk exports to make the data available as php objects. The source data is available to the url https://www.data.gouv.fr/fr/datasets/base-sirene-des-entreprises-et-de-leurs-etablissements-siren-siret.
Installation
The installation of this library is made via composer.
Download composer.phar
from their website.
Then add to your composer.json :
"require": {
...
"php-extended/php-insee-sirene-bulk-api": "^3"
...
}
Then run php composer.phar update
to install this library.
The autoloading of all classes of this library is made through composer's autoloader.
Basic Usage
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();
License
The code is under MIT (See license file).