php-extended/php-ensap-gfr-api

This package is abandoned and no longer maintained. The author suggests using the php-extended/php-api-fr-gouv-ensap-object package instead.

A php API wrapper to connect to ensap.gouv.fr instances

5.2.5 2020-12-20 14:58 UTC

README

A php API wrapper to connect to ensap.gouv.fr instances

coverage build status

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-ensap-gfr-api": "^5"
		...
	}

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

This library may be used the following way. First, we need to log in, this needs the NIR number (no_secu) and the associated password.


use PhpExtended\Ensap\EnsapApiEndpoint;

/* @var $client \Psr\Http\Client\ClientInterface */
/* @var $uriFactory \Psr\Http\Message\UriFactory */
/* @var $requestFactory \Psr\Http\Message\RequestFactory */

$endpoint = new EnsapApiEndpoint($client, $uriFactory, $requestFactory);

// first, we need to log in
$endpoint->logint('<no_secu>', '<password>');

Next, you can retrieve the list of recent events :


$endpoint->getDataAccueilConnecte();	// returns EnsapApiAccueilConnecte object

Or you can retreive the list of documents for your remuneration :


$endpoint->getDataRemuneration();		// returns EnsapApiRemuneration object

Finally, you can get the raw data of the documents in both objects by using their uuid :


$endpoint->getRawDocument($documentUuid);	// returns EnsapApiRawDocument object

There also exists an experimental parser for bulletin pdf files.


$endpoint->getBulletinFromRawDocument(EnsapApiRawDocument $document);	// returns EnsapApiBulletin object

As this parser is experimental, it may fail (and throw \RuntimeExceptions) even if the pdf is a perfectly human readable pdf file. Test it on your pdf files and give me a pull request for it to be improved !

Wants to be working with the versions of the pdf generator :

  • PAY18E - V1.4 - 25102016 (since dec 2016)
  • PAY18E - V1.6 - 04122017 (since feb 2018)
  • PAY18E - V2.0 - 26062018 (since oct 2018)
  • PAY18E - V2.1 - 28112018 (since dec 2018)
  • PAY18E - V2.3 - 29032019 (since apr 2019)

License

MIT (See license file).