everbinding/econnect-psb-php
Composer 安装命令:
composer require everbinding/econnect-psb-php
包简介
PHP example implementation for using the Procurement Service Bus.
README 文档
README
A reference implementation meant as an example how to use the PSB api using PHP.
Requirements
- PHP 7.2 or greater
Install
- Install library using
composer.
composer require everbinding/econnect-psb-php
Then include composer autoloader.
require __DIR__ . '/vendor/autoload.php';
Configure
$config = \EConnect\Psb\Configuration::getDefaultConfiguration(); $config ->setUsername("{username}") ->setPassword("{password}"); ->setClientId("{clientId}") ->setClientSecret("{clientSecret}") ->setHost("https://psb.econnect.eu") ->setApiKey('Subscription-Key', '{subscription key}');
Login
Login using the default configuration.
$config = \EConnect\Psb\Configuration::getDefaultConfiguration(); $authN = new \EConnect\Psb\Authentication($config); $authN->login();
Use api
Use the api using the default configuration after a successful login.
In this example we are calling the send sales invoice api. The user must have send permission on the provide sender partyId. Also make sure the UBL is valid, otherwise it will be block for sending. The receiver partyId is optional, the PSB will use the best possible route we no receiver partyId is provided.
$config = \EConnect\Psb\Configuration::getDefaultConfiguration(); $salesInvoiceApi = new EConnect\Psb\Api\SalesInvoiceApi( new GuzzleHttp\Client(); $config ); $yourPartyId = "senderPartyId"; $filePath = "./Ubl.xml"; $receiverPartyId = null; $salesInvoiceApi->sendSalesInvoice($yourPartyId, $filePath, $receiverPartyId);
Example client
There is a simple example php client that you can run on a php webserver. With the example you can send an invoice via Peppol.
Also there is a webhook receiver example that you need to have in order to receive invoices from Peppol.
Build your own source
Instead of using this code, you could also generate the php code yourself using the openapi-generator-cli.
openapi-generator-cli generate -g php -i https://psb.econnect.eu/v1/swagger.json?subscriptionKey={your-subscription} -o C:\temp --additional-properties=invokerPackage=EConnect\Psb
And use Jumbojett\OpenIDConnectClient to get the access token.
You can also copy the code from: Authentication.php
use Jumbojett\OpenIDConnectClient; $oidc = new OpenIDConnectClient('https://identity.econnect.eu', '{clientId}', '{clientSecret}'); $oidc->addScope('ap'); // Add username and password $oidc->addAuthParam(array('username'=>'{username}')); $oidc->addAuthParam(array('password'=>'{password}')); // to validate the JWT and whether the acces_token property is present $token = $oidc->requestResourceOwnerToken(TRUE)->access_token;
Read more
If you want to know more about Peppol e-procurement or other procurement network the go to the Procurement Service Bus introduction page.
everbinding/econnect-psb-php 适用场景与选型建议
everbinding/econnect-psb-php 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 290 次下载、GitHub Stars 达 6, 最近一次更新时间为 2021 年 08 月 02 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「peppol」 「econnect」 「psb」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 everbinding/econnect-psb-php 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 everbinding/econnect-psb-php 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 everbinding/econnect-psb-php 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Peppyrus PHP API client
PromSvyazBank (https://www.psbank.ru/) acquiring API PHP Software Development Kit.
CCV Shop implementation for the PSB of econnect.
A modern object-oriented PHP library to create valid UBL and Peppol BIS 3.0 files
UBL 2.x XSD-to-PHP 8.4+
XML eFaktura PEF
统计信息
- 总下载量: 290
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 6
- 点击次数: 17
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: unlicense
- 更新时间: 2021-08-02