php-extended / php-ensap-gfr-api
5.2.5
2020-12-20 14:58 UTC
Requires
- php: >=7.0
- php-extended/php-json-object: ^5
- php-extended/polyfill-php80-stringable: ^1
- psr/http-client: ^1
- psr/http-factory: ^1
- smalot/pdfparser: ^0.16
Requires (Dev)
This package is auto-updated.
Last update: 2020-12-20 21:20:01 UTC
README
一个用于连接到ensap.gouv.fr实例的php API包装器
安装
此库的安装通过composer进行。从他们的网站下载composer.phar
。然后将其添加到您的composer.json文件中
"require": {
...
"php-extended/php-ensap-gfr-api": "^5"
...
}
然后运行php composer.phar update
以安装此库。此库中所有类的自动加载均通过composer的自动加载器完成。
基本用法
此库可以按以下方式使用。首先,我们需要登录,这需要NIR编号(no_secu)和相关的密码。
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>');
接下来,您可以获取最近事件的列表
$endpoint->getDataAccueilConnecte(); // returns EnsapApiAccueilConnecte object
或者,您可以获取您的报酬文档列表
$endpoint->getDataRemuneration(); // returns EnsapApiRemuneration object
最后,您可以通过它们的uuid获取文档的原始数据
$endpoint->getRawDocument($documentUuid); // returns EnsapApiRawDocument object
还有一个用于公告PDF文件的实验性解析器。
$endpoint->getBulletinFromRawDocument(EnsapApiRawDocument $document); // returns EnsapApiBulletin object
由于此解析器是实验性的,即使PDF文件是完全可读的,它也可能失败(并抛出\RuntimeException
)。请在您的PDF文件上测试它,并为改进提出pull request!
希望与PDF生成器的版本一起工作
- PAY18E - V1.4 - 25102016(自2016年12月起)
- PAY18E - V1.6 - 04122017(自2018年2月起)
- PAY18E - V2.0 - 26062018(自2018年10月起)
- PAY18E - V2.1 - 28112018(自2018年12月起)
- PAY18E - V2.3 - 29032019(自2019年4月起)
许可
MIT(见许可文件)。