Download the PHP package useyona/einvoice-php without Composer

On this page you can find all versions of the php package useyona/einvoice-php. 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 einvoice-php

useyona/einvoice-php

The official PHP SDK for the Yona e-invoicing API: create and manage invoices, report them to the tax authority, and work with buyers, items, received invoices, billing and webhooks. PHP 8.1+, built on PSR-18, so it works with the HTTP client you already have.

Every Yona SDK has the same modules and methods; in PHP the names are camelCase ($client->invoices->issueCreditNote()).

Install

The SDK needs a PSR-18 HTTP client. If your project has none, composer require guzzlehttp/guzzle installs one that the SDK finds automatically.

Quick start

Sandbox and live

The key is the only configuration. An sk_test_… key works in the sandbox and an sk_live_… key in live, on the same host; $client->mode() tells you which. Going live means deploying a live key, nothing else changes.

To make a deployment refuse a key of the wrong kind:

Responses and pagination

Methods return the API's answer as an array with the API's field names ($invoice['invoiceNumber']); the shapes are documented for phpstan and your IDE. List methods return a page:

EInvoice::paginate walks every page for you:

Received invoices and issued history return a Paginated object with the items under $res->data['items']. PDF downloads return a BinaryResponse (data, contentType, fileName).

Errors

A refused request throws an exception chosen by status:

Status Exception
400, 422 ValidationException
401 AuthenticationException
402 InsufficientCreditsException
403 PermissionException
404 NotFoundException
409 ConflictException
429 RateLimitException
5xx ServerException

All extend ApiException, which carries status, errorCode, errors (per field), requestId and retryAfter:

Branch on errorCode, not on the message. Problems before the API answers are TimeoutException, ConnectionException and ConfigException; all SDK exceptions extend EInvoiceException.

Retries and idempotency

Reads, and writes that carry an Idempotency-Key, are retried automatically on network errors, timeouts, 408, 429 and 5xx, with backoff and respecting Retry-After. Other writes are never retried.

Where the API accepts an Idempotency-Key (creating an invoice, submitting, sending, downloading…) the SDK generates one per call, so a retry is never applied or charged twice. Pass your own to make a retry safe across restarts:

Tune the defaults with timeout and retry in the configuration, or per call with RequestOptions (headers, maxRetries).

Webhooks

verifyWebhook checks the Yona-Signature header over the raw body and returns the event. Always pass the raw body, and deduplicate on $event['id']. Webhooks::signWebhookPayload signs a payload the way Yona does, so you can test your handler locally. Endpoints are registered in the dashboard; the SDK can list and test them and inspect deliveries.

Guides

examples/ holds complete, runnable walkthroughs: your first invoice, webhooks, errors and retries, sandbox and live, received invoices. Run them against your sandbox key with YONA_API_KEY=sk_test_… make examples.

API reference

Every method takes an optional trailing ?RequestOptions $options. Request and query arrays have shapes named after the operation (CreateInvoiceBody, ListInvoicesQuery) in Useyona\EInvoice\Generated\Types.

Module Methods
$client->invoices create, list, get, update, delete, finalise, reopen, revise, cancel, issueCreditNote, issueDebitNote, getOverview, getStatistics, getSummary
$client->submissions submit, issue, createAndSubmit, batchSubmit, retry, renumber, queryStatus, getStatus, recordPayment, getAuthorityCopy
$client->output getDownloadLink, downloadPdf, send
$client->shareLinks create, list, revoke
$client->items list, create, get, update, delete, archive, unarchive, listUsedCodes
$client->reference listHsCodes, listHsCodeCategories, listResources, getResource, lookupTaxId, validateInvoice
$client->buyers create, list, get, update, delete, bulkDelete, verifyTaxNumber, getVerificationStatus, search, checkReachability, checkWithTaxAuthority
$client->sellers list, get, getVerificationStatus, search
$client->inboundInvoices list, get, getAnalytics, listHistoryRuns, getHistoryRun
$client->issuedHistory list, get, downloadPdf
$client->invoiceSettings, $client->taxConnection get
$client->organization get, getReadiness
$client->billing->accounts getMine, getStats, checkBalance
$client->billing->payments list, get
$client->billing->sandbox listTransactions, getUsage
$client->billing->statements get
$client->billing->subscriptions getActive, list, get, listRenewals, previewPlanChange
$client->billing->transactions list, get, getUsageAnalytics, getUsageByCostCode
$client->webhooks->endpoints list, get, test
$client->webhooks->deliveries list, get, redeliver
$client->webhooks->events list, get, redeliver
$client->webhooks->eventTypes list
Webhooks verifyWebhook, signWebhookPayload, computeWebhookSignature, parseSignatureHeader

Account management (users, roles, API keys, purchases, webhook endpoint settings) is done in the Yona dashboard, not through the API key.

Configuration

new EInvoice([...]) accepts:

Option Purpose
timeout timeout in seconds for the HTTP client the SDK creates (default 30)
retry max_retries (2), base_delay (0.5 s), max_delay (8 s), max_retry_after (60 s)
headers headers sent on every request
http_client, request_factory, stream_factory your own PSR-18 client and PSR-17 factories (proxy, TLS)
base_url another gateway, for local development only; the key decides sandbox or live

Development

License

MIT


All versions of einvoice-php with dependencies

PHP Build Version
Package Version
Requires php Version >=8.1
ext-json Version *
psr/http-client Version ^1.0
psr/http-factory Version ^1.0
psr/http-message Version ^1.1 || ^2.0
php-http/discovery Version ^1.19
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 useyona/einvoice-php contains the following files

Loading the files please wait ...