Download the PHP package n1ebieski/ksef-php-client without Composer

On this page you can find all versions of the php package n1ebieski/ksef-php-client. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package ksef-php-client

1920x810

KSEF PHP Client

PHP API client that allows you to interact with the KSEF API Krajowy System e-Faktur

Main features:

KSEF Version Branch Release Version
2.0 main ^1.0
1.0 0.2.x 0.2.*

Table of Contents

Get Started

Requires PHP 8.1+

First, install ksef-php-client via the Composer package manager:

Ensure that the php-http/discovery composer plugin is allowed to run or install a client manually if your project does not already have a PSR-18 client integrated.

Client configuration

Auto mapping

Each resource supports mapping through both an array and a DTO, for example:

or:

Deserialization

DTOs that implement N1ebieski\KSEFClient\Contracts\XmlDeserializableInterface can be deserialized directly from XML.

Example:

Valinor Cache

For best performance, it is recommended to use caching:

or directly for a DTO:

[!IMPORTANT] If you are using caching, remember to clear the cache after updating this package!

More information: https://valinor-php.dev/2.3/other/performance-and-caching/

Authorization

Auto authorization via KSEF Token

Auto authorization via certificate .p12

or:

Manual authorization

Resources

Auth

Auth Challenge

https://api-test.ksef.mf.gov.pl/docs/v2/index.html#tag/Uzyskiwanie-dostepu/paths/~1auth~1challenge/post

Auth Xades Signature

https://api-test.ksef.mf.gov.pl/docs/v2/index.html#tag/Uzyskiwanie-dostepu/paths/~1auth~1xades-signature/post or:

Auth Status

https://api-test.ksef.mf.gov.pl/docs/v2/index.html#tag/Uzyskiwanie-dostepu/paths/~1auth~1%7BreferenceNumber%7D/get

Auth Token

Auth Token Redeem
https://api-test.ksef.mf.gov.pl/docs/v2/index.html#tag/Uzyskiwanie-dostepu/paths/~1auth~1token~1redeem/post
Auth Token Refresh
https://api-test.ksef.mf.gov.pl/docs/v2/index.html#tag/Uzyskiwanie-dostepu/paths/~1auth~1token~1refresh/post

Auth Sessions

Auth Sessions list
https://api-test.ksef.mf.gov.pl/docs/v2/index.html#tag/Aktywne-sesje/paths/~1auth~1sessions/get
Auth Sessions revoke current
https://api-test.ksef.mf.gov.pl/docs/v2/index.html#tag/Aktywne-sesje/paths/~1auth~1sessions~1current/delete
Auth Sessions revoke
https://api-test.ksef.mf.gov.pl/docs/v2/index.html#tag/Aktywne-sesje/paths/~1auth~1sessions~1%7BreferenceNumber%7D/delete

Limits

Limits Context

https://api-test.ksef.mf.gov.pl/docs/v2/index.html#tag/Limity-i-ograniczenia/paths/~1limits~1context/get

Limits Subject

https://api-test.ksef.mf.gov.pl/docs/v2/index.html#tag/Limity-i-ograniczenia/paths/~1limits~1subject/get

Rate Limits

https://api-test.ksef.mf.gov.pl/docs/v2/index.html#tag/Limity-i-ograniczenia/paths/~1rate-limits/get

Security

Security Public Key Certificates

https://api-test.ksef.mf.gov.pl/docs/v2/index.html#tag/Certyfikaty-klucza-publicznego/paths/~1security~1public-key-certificates/get

Sessions

Sessions List

https://api-test.ksef.mf.gov.pl/docs/v2/index.html#tag/Status-wysylki-i-UPO/paths/~1sessions/get

Sessions Invoices

Sessions Invoices List
https://api-test.ksef.mf.gov.pl/docs/v2/index.html#tag/Status-wysylki-i-UPO/paths/~1sessions~1%7BreferenceNumber%7D~1invoices/get
Sessions Invoices Failed
https://api-test.ksef.mf.gov.pl/docs/v2/index.html#tag/Status-wysylki-i-UPO/paths/~1sessions~1%7BreferenceNumber%7D~1invoices~1failed/get
Sessions Invoices Upo
https://api-test.ksef.mf.gov.pl/docs/v2/index.html#tag/Status-wysylki-i-UPO/paths/~1sessions~1%7BreferenceNumber%7D~1invoices~1%7BinvoiceReferenceNumber%7D~1upo/get
Sessions Invoices Ksef Upo
https://api-test.ksef.mf.gov.pl/docs/v2/index.html#tag/Status-wysylki-i-UPO/paths/~1sessions~1%7BreferenceNumber%7D~1invoices~1ksef~1%7BksefNumber%7D~1upo/get
Sessions Invoices Status
https://api-test.ksef.mf.gov.pl/docs/v2/index.html#tag/Status-wysylki-i-UPO/paths/~1sessions~1%7BreferenceNumber%7D~1invoices~1%7BinvoiceReferenceNumber%7D/get

Sessions Online

Sessions Online Open
https://api-test.ksef.mf.gov.pl/docs/v2/index.html#tag/Wysylka-interaktywna/paths/~1sessions~1online/post
Sessions Online Close
https://api-test.ksef.mf.gov.pl/docs/v2/index.html#tag/Wysylka-interaktywna/paths/~1sessions~1online~1%7BreferenceNumber%7D~1close/post
Sessions Online Send invoices
https://api-test.ksef.mf.gov.pl/docs/v2/index.html#tag/Wysylka-interaktywna/paths/~1sessions~1online~1%7BreferenceNumber%7D~1invoices/post for DTO invoice: for XML invoice:

Sessions Batch

Sessions Batch Open (and send multiple invoices)
https://api-test.ksef.mf.gov.pl/docs/v2/index.html#tag/Wysylka-wsadowa/paths/~1sessions~1batch/post for DTOs invoices: for XMLs invoices: for ZIP invoices:
Sessions Batch Close
https://api-test.ksef.mf.gov.pl/docs/v2/index.html#tag/Wysylka-wsadowa/paths/~1sessions~1batch~1%7BreferenceNumber%7D~1close/post

Sessions Status

https://api-test.ksef.mf.gov.pl/docs/v2/index.html#tag/Status-wysylki-i-UPO/paths/~1sessions~1%7BreferenceNumber%7D/get

Sessions Upo

https://api-test.ksef.mf.gov.pl/docs/v2/index.html#tag/Status-wysylki-i-UPO/paths/~1sessions~1%7BreferenceNumber%7D~1upo~1%7BupoReferenceNumber%7D/get

Invoices

Invoices Download

https://api-test.ksef.mf.gov.pl/docs/v2/index.html#tag/Pobieranie-faktur/paths/~1invoices~1ksef~1%7BksefNumber%7D/get

Invoices Query

Invoices Query Metadata
https://api-test.ksef.mf.gov.pl/docs/v2/index.html#tag/Pobieranie-faktur/paths/~1invoices~1query~1metadata/post

Invoices Exports

Invoices Exports Init
https://api-test.ksef.mf.gov.pl/docs/v2/index.html#tag/Pobieranie-faktur/paths/~1invoices~1exports/post
Invoices Exports Status
https://api-test.ksef.mf.gov.pl/docs/v2/index.html#tag/Pobieranie-faktur/paths/~1invoices~1exports~1%7BoperationReferenceNumber%7D/get

Permissions

Permissions Persons

Permissions Persons Grants
https://api-test.ksef.mf.gov.pl/docs/v2/index.html#tag/Nadawanie-uprawnien/paths/~1permissions~1persons~1grants/post

Permissions Entities

Permissions Entities Grants
https://api-test.ksef.mf.gov.pl/docs/v2/index.html#tag/Nadawanie-uprawnien/paths/~1permissions~1entities~1grants/post

Permissions Authorizations

Permissions Authorizations Grants
https://api-test.ksef.mf.gov.pl/docs/v2/index.html#tag/Nadawanie-uprawnien/paths/~1permissions~1authorizations~1grants/post
Permissions Authorizations Grants Revoke
https://api-test.ksef.mf.gov.pl/docs/v2/index.html#tag/Odbieranie-uprawnien/paths/~1permissions~1authorizations~1grants~1%7BpermissionId%7D/delete

Permissions Indirect

Permissions Indirect Grants
https://api-test.ksef.mf.gov.pl/docs/v2/index.html#tag/Nadawanie-uprawnien/paths/~1permissions~1indirect~1grants/post

Permissions Subunits

Permissions Subunits Grants
https://api-test.ksef.mf.gov.pl/docs/v2/index.html#tag/Nadawanie-uprawnien/paths/~1permissions~1subunits~1grants/post

Permissions EuEntities

Permissions EuEntities Grants
https://api-test.ksef.mf.gov.pl/docs/v2/index.html#tag/Nadawanie-uprawnien/paths/~1permissions~1eu-entities~1grants/post
Permissions EuEntities Administration
Permissions EuEntities Administration Grants
https://api-test.ksef.mf.gov.pl/docs/v2/index.html#tag/Nadawanie-uprawnien/paths/~1permissions~1eu-entities~1administration~1grants/post

Permissions Common

Permissions Common Grants Revoke
https://api-test.ksef.mf.gov.pl/docs/v2/index.html#tag/Odbieranie-uprawnien/paths/~1permissions~1common~1grants~1%7BpermissionId%7D/delete

Permissions Query

Permissions Query Authorizations
Permissions Query Authorizations Grants
https://api-test.ksef.mf.gov.pl/docs/v2/index.html#tag/Wyszukiwanie-nadanych-uprawnien/paths/~1permissions~1query~1authorizations~1grants/post
Permissions Query Entities
Permissions Query Entities Grants
https://api-test.ksef.mf.gov.pl/docs/v2/index.html#tag/Wyszukiwanie-nadanych-uprawnien/paths/~1permissions~1query~1entities~1grants/post
Permissions Query Entities Roles
https://api-test.ksef.mf.gov.pl/docs/v2/index.html#tag/Wyszukiwanie-nadanych-uprawnien/paths/~1permissions~1query~1entities~1roles/get
Permissions Query EuEntities
Permissions Query EuEntities Grants
https://api-test.ksef.mf.gov.pl/docs/v2/index.html#tag/Wyszukiwanie-nadanych-uprawnien/paths/~1permissions~1query~1eu-entities~1grants/post
Permissions Query Personal
Permissions Query Personal Grants
https://api-test.ksef.mf.gov.pl/docs/v2/index.html#tag/Wyszukiwanie-nadanych-uprawnien/paths/~1permissions~1query~1personal~1grants/post
Permissions Query Persons
Permissions Query Persons Grants
https://api-test.ksef.mf.gov.pl/docs/v2/index.html#tag/Wyszukiwanie-nadanych-uprawnien/paths/~1permissions~1query~1persons~1grants/post
Permissions Query Subunits
Permissions Query Subunits Grants
https://api-test.ksef.mf.gov.pl/docs/v2/index.html#tag/Wyszukiwanie-nadanych-uprawnien/paths/~1permissions~1query~1subunits~1grants/post
Permissions Query SubordinateEntities
Permissions Query SubordinateEntities Roles
https://api-test.ksef.mf.gov.pl/docs/v2/index.html#tag/Wyszukiwanie-nadanych-uprawnien/paths/~1permissions~1query~1subordinate-entities~1roles/post

Permissions Operations

Permissions Operations Status
https://api-test.ksef.mf.gov.pl/docs/v2/index.html#tag/Operacje/paths/~1permissions~1operations~1%7BreferenceNumber%7D/get

Permissions Attachments

Permissions Attachments Status
https://api-test.ksef.mf.gov.pl/docs/v2/index.html#tag/Operacje/paths/~1permissions~1attachments~1status/get

Certificates

Certificates Limits

https://api-test.ksef.mf.gov.pl/docs/v2/index.html#tag/Certyfikaty/paths/~1certificates~1limits/get

Certificates Enrollments

Certificates Enrollments Data
https://api-test.ksef.mf.gov.pl/docs/v2/index.html#tag/Certyfikaty/paths/~1certificates~1enrollments~1data/get
Certificates Enrollments Send
https://api-test.ksef.mf.gov.pl/docs/v2/index.html#tag/Certyfikaty/paths/~1certificates~1enrollments/post
Certificates Enrollments Status
https://api-test.ksef.mf.gov.pl/docs/v2/index.html#tag/Certyfikaty/paths/~1certificates~1enrollments~1%7BreferenceNumber%7D/get

Certificates Retrieve

https://api-test.ksef.mf.gov.pl/docs/v2/index.html#tag/Certyfikaty/paths/~1certificates~1retrieve/post

Certificates Revoke

https://api-test.ksef.mf.gov.pl/docs/v2/index.html#tag/Certyfikaty/paths/~1certificates~1%7BcertificateSerialNumber%7D~1revoke/post

Certificates Query

https://api-test.ksef.mf.gov.pl/docs/v2/index.html#tag/Certyfikaty/paths/~1certificates~1query/post

Tokens

Tokens Create

https://api-test.ksef.mf.gov.pl/docs/v2/index.html#tag/Tokeny-KSeF/paths/~1tokens/post

Tokens List

https://api-test.ksef.mf.gov.pl/docs/v2/index.html#tag/Tokeny-KSeF/paths/~1tokens/get

Tokens Status

https://api-test.ksef.mf.gov.pl/docs/v2/index.html#tag/Tokeny-KSeF/paths/~1tokens~1%7BreferenceNumber%7D/get

Tokens Revoke

https://api-test.ksef.mf.gov.pl/docs/v2/index.html#tag/Tokeny-KSeF/paths/~1tokens~1%7BreferenceNumber%7D/delete

Peppol

Peppol Query

https://api-test.ksef.mf.gov.pl/docs/v2/index.html#tag/Uslugi-Peppol/paths/~1peppol~1query/get

Testdata

Testdata Attachment

Testdata Attachment Approve
https://api-test.ksef.mf.gov.pl/docs/v2/index.html#tag/Dane-testowe/paths/~1testdata~1attachment/post
Testdata Attachment Revoke
https://api-test.ksef.mf.gov.pl/docs/v2/index.html#tag/Dane-testowe/paths/~1testdata~1attachment~1revoke/post

Testdata Person

Testdata Person Create
https://api-test.ksef.mf.gov.pl/docs/v2/index.html#tag/Dane-testowe/paths/~1testdata~1person/post
Testdata Person Remove
https://api-test.ksef.mf.gov.pl/docs/v2/index.html#tag/Dane-testowe/paths/~1testdata~1person~1remove/post

Testdata Context

Testdata Context Block
https://api-test.ksef.mf.gov.pl/docs/v2/index.html#tag/Dane-testowe/paths/~1testdata~1context~1block/post
Testdata Context Unblock
https://api-test.ksef.mf.gov.pl/docs/v2/index.html#tag/Dane-testowe/paths/~1testdata~1context~1unblock/post

Testdata Permissions

Testdata Permissions Grants
https://api-test.ksef.mf.gov.pl/docs/v2/index.html#tag/Dane-testowe/paths/~1testdata~1permissions/post
Testdata Permissions Revoke
https://api-test.ksef.mf.gov.pl/docs/v2/index.html#tag/Dane-testowe/paths/~1testdata~1permissions~1revoke/post

Testdata Limits

Testdata Limits Context
Testdata Limits Context Session
Testdata Limits Context Session Limits
https://api-test.ksef.mf.gov.pl/docs/v2/index.html#tag/Limity-i-ograniczenia/paths/~1testdata~1limits~1context~1session/post
Testdata Limits Context Session Reset
https://api-test.ksef.mf.gov.pl/docs/v2/index.html#tag/Limity-i-ograniczenia/paths/~1testdata~1limits~1context~1session/delete
Testdata Limits Subject
Testdata Limits Subject Certificate
Testdata Limits Subject Certificate Limits
https://api-test.ksef.mf.gov.pl/docs/v2/index.html#tag/Limity-i-ograniczenia/paths/~1testdata~1limits~1subject~1certificate/post
Testdata Limits Subject Certificate Reset
https://api-test.ksef.mf.gov.pl/docs/v2/index.html#tag/Limity-i-ograniczenia/paths/~1testdata~1limits~1subject~1certificate/delete

Testdata Rate Limits

Testdata Rate Limits Limits
https://api-test.ksef.mf.gov.pl/docs/v2/index.html#tag/Limity-i-ograniczenia/paths/~1testdata~1rate-limits/post
Testdata Rate Limits Reset
https://api-test.ksef.mf.gov.pl/docs/v2/index.html#tag/Limity-i-ograniczenia/paths/~1testdata~1rate-limits/delete
Testdata Rate Limits Production
https://api-test.ksef.mf.gov.pl/docs/v2/index.html#tag/Limity-i-ograniczenia/paths/~1testdata~1rate-limits/delete

Latarnia

Latarnia Status

https://github.com/CIRFMF/ksef-latarnia/blob/main/scenariusze.md

Latarnia Messages

https://github.com/CIRFMF/ksef-latarnia/blob/main/scenariusze.md

Examples

Integration with a frontend application using certificate-based authentication

https://github.com/N1ebieski/ksef-app-example.test

Conversion of the KSEF certificate and private key from MCU to a .p12 file

Generate a KSEF certificate and convert to a .p12 file

Send an invoice, check for UPO and generate QR code

Generate PDF for the invoice and the UPO file

[PDF invoice example.pdf](https://github.com/user-attachments/files/23744618/ONLINE.pdf) [UPO-example.pdf](https://github.com/user-attachments/files/23747747/UPO-20251124-EE-4148363000-80035B5E1C-6A.pdf) Install [n1ebieski/ksef-pdf-generator](https://github.com/N1ebieski/ksef-pdf-generator/tree/feature/cli)

Generate PDF for the transaction confirmation with both QR codes

[PDF confirmation example.pdf](https://github.com/user-attachments/files/24212098/CONFIRMATION-INV-6942913FCDB55.pdf) Read https://ksef.podatki.gov.pl/informacje-ogolne-ksef-20/potwierdzenie-transakcji/ Install [n1ebieski/ksef-pdf-generator](https://github.com/N1ebieski/ksef-pdf-generator/tree/feature/cli)

Batch async send multiple invoices and check for UPO

Create an offline invoice and generate both QR codes

Generate PDF for the offline invoice file with both QR codes

[PDF offline invoice EC certificate example.pdf](https://github.com/user-attachments/files/23744619/OFFLINE-CERTYFIKAT-EC.pdf) [PDF offline invoice RSA certificate example.pdf](https://github.com/user-attachments/files/23744620/OFFLINE-CERTYFIKAT-RSA.pdf) Install [n1ebieski/ksef-pdf-generator](https://github.com/N1ebieski/ksef-pdf-generator/tree/feature/cli)

Download, decrypt invoices, and deserialize them into DTOs

Testing

The package uses unit and feature tests via Pest.

Pest configuration is located in

Fake request and responses fixtures for resources are located in

Run all tests:

Roadmap

  1. 23.03.2026 – Release of v1.0.0-rc.* (from this point, avoid any breaking changes unless KSeF team forces us)
  2. 01.04.2026 – Release of v1.0.0 (production ready)
  3. End of 2026 – The release of the major version drops support for PHP 8.1–8.3 and upgrades the package to utilize features and dependencies of PHP 8.4.

Special thanks

Special thanks to:


All versions of ksef-php-client with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1.0
ext-dom Version *
ext-json Version *
ext-libxml Version *
ext-mbstring Version *
ext-openssl Version *
ext-zip Version *
php-http/discovery Version ^1.20.0
psr/http-client Version ^1.0.3
psr/http-client-implementation Version ^1.0.1
psr/http-factory-implementation Version ^1.1
psr/http-message Version ^1.1.0 || ^2.0.0
psr/simple-cache Version ^3.0
cuyz/valinor Version ^1.15 || ^2.0
krowinski/bcmath-extended Version ^6.0
psr-discovery/log-implementations Version ^1.0
phpseclib/phpseclib Version ^3.0.52
endroid/qr-code Version ^5.1
symfony/polyfill-php82 Version ^1.33
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package n1ebieski/ksef-php-client contains the following files

Loading the files please wait ...