{"id":33963253,"url":"https://github.com/theinvoicingcompany/econnect-psb-php","last_synced_at":"2025-12-12T22:31:27.716Z","repository":{"id":56980079,"uuid":"391998678","full_name":"theinvoicingcompany/econnect-psb-php","owner":"theinvoicingcompany","description":"A reference implementation meant as an example how to use the PSB api using PHP.","archived":false,"fork":false,"pushed_at":"2023-03-22T13:27:41.000Z","size":68,"stargazers_count":5,"open_issues_count":0,"forks_count":4,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-10-01T04:58:27.170Z","etag":null,"topics":["econnect","peppol"],"latest_commit_sha":null,"homepage":"https://psb.econnect.eu/introduction/overview.html","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/theinvoicingcompany.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-08-02T15:20:51.000Z","updated_at":"2025-09-12T14:55:38.000Z","dependencies_parsed_at":"2022-08-21T10:50:21.053Z","dependency_job_id":null,"html_url":"https://github.com/theinvoicingcompany/econnect-psb-php","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/theinvoicingcompany/econnect-psb-php","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/theinvoicingcompany%2Feconnect-psb-php","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/theinvoicingcompany%2Feconnect-psb-php/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/theinvoicingcompany%2Feconnect-psb-php/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/theinvoicingcompany%2Feconnect-psb-php/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/theinvoicingcompany","download_url":"https://codeload.github.com/theinvoicingcompany/econnect-psb-php/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/theinvoicingcompany%2Feconnect-psb-php/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":27693455,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-12-12T02:00:06.775Z","response_time":129,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["econnect","peppol"],"created_at":"2025-12-12T22:31:27.053Z","updated_at":"2025-12-12T22:31:27.701Z","avatar_url":"https://github.com/theinvoicingcompany.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PHP Client\n\nA reference implementation meant as an example how to use the PSB api using PHP.\n\n## Requirements\n\n- PHP 7.2 or greater\n\n## Install\n\n- Install library using [`composer`][0].\n\n```sh\ncomposer require everbinding/econnect-psb-php\n```\n\nThen include composer autoloader.\n\n```php\nrequire __DIR__ . '/vendor/autoload.php';\n```\n\n## Configure\n\n```php\n$config = \\EConnect\\Psb\\Configuration::getDefaultConfiguration();\n\n$config\n    -\u003esetUsername(\"{username}\")\n    -\u003esetPassword(\"{password}\");\n    -\u003esetClientId(\"{clientId}\")\n    -\u003esetClientSecret(\"{clientSecret}\")\n    -\u003esetHost(\"https://psb.econnect.eu\")\n    -\u003esetApiKey('Subscription-Key', '{subscription key}');\n```\n\n## Login\n\nLogin using the default configuration.\n\n```php\n$config = \\EConnect\\Psb\\Configuration::getDefaultConfiguration();\n\n$authN = new \\EConnect\\Psb\\Authentication($config);\n$authN-\u003elogin();\n```\n\n## Use api\n\nUse the api using the default configuration after a successful login.\nIn this example we are calling the send sales invoice api. The user must have send permission on the provide sender [`partyId`][7]. Also make sure the UBL is valid, otherwise it will be block for sending. The receiver [`partyId`][7] is optional, the PSB will use the best possible route we no receiver partyId is provided.\n\n```php\n$config = \\EConnect\\Psb\\Configuration::getDefaultConfiguration();\n\n$salesInvoiceApi = new EConnect\\Psb\\Api\\SalesInvoiceApi(\n    new GuzzleHttp\\Client();\n    $config\n);\n\n$yourPartyId = \"senderPartyId\";\n$filePath = \"./Ubl.xml\";\n$receiverPartyId = null;\n\n$salesInvoiceApi-\u003esendSalesInvoice($yourPartyId, $filePath, $receiverPartyId);\n```\n\n## Example client\n\nThere is a [`simple example php client`][1] that you can run on a php webserver. With the example you can [`send an invoice via Peppol`][8].\nAlso there is a [`webhook receiver example`][2] that you need to have in order to [`receive invoices from Peppol`][9].\n\n## Build your own source\n\nInstead of using this code, you could also generate the php code yourself using the [`openapi-generator-cli`][3].\n\n```sh\nopenapi-generator-cli generate -g php -i https://psb.econnect.eu/v1/swagger.json?subscriptionKey={your-subscription} -o C:\\temp --additional-properties=invokerPackage=EConnect\\Psb\n```\n\nAnd use [`Jumbojett\\OpenIDConnectClient`][4] to get the access token.\nYou can also copy the code from: [`Authentication.php`][5]\n\n```php\nuse Jumbojett\\OpenIDConnectClient;\n\n$oidc = new OpenIDConnectClient('https://identity.econnect.eu',\n                                '{clientId}',\n                                '{clientSecret}');\n\n$oidc-\u003eaddScope('ap');\n\n// Add username and password\n$oidc-\u003eaddAuthParam(array('username'=\u003e'{username}'));\n$oidc-\u003eaddAuthParam(array('password'=\u003e'{password}'));\n\n// to validate the JWT and whether the acces_token property is present\n$token = $oidc-\u003erequestResourceOwnerToken(TRUE)-\u003eaccess_token;\n```\n\n## Read more\n\nIf you want to know more about Peppol e-procurement or other procurement network the go to the [`Procurement Service Bus introduction page`][6].\n\n[0]: https://getcomposer.org/\n[1]: ./ExampleSendInvoice.php\n[2]: ./ExampleWebhookReceiver.php\n[3]: https://github.com/OpenAPITools/openapi-generator-cli\n[4]: https://github.com/jumbojett/OpenID-Connect-PHP#example-5-request-resource-owners-token-with-client-auth\n[5]: ./lib/Authentication.php\n[6]: https://psb.econnect.eu/introduction/overview.html\n[7]: https://psb.econnect.eu/misc/partyIds.html\n[8]: https://psb.econnect.eu/introduction/sendInvoice.html\n[9]: https://psb.econnect.eu/introduction/receiveInvoice.html","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftheinvoicingcompany%2Feconnect-psb-php","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftheinvoicingcompany%2Feconnect-psb-php","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftheinvoicingcompany%2Feconnect-psb-php/lists"}