Download the PHP package ejosterberg/opensalestax-invoice-ninja without Composer

On this page you can find all versions of the php package ejosterberg/opensalestax-invoice-ninja. 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 opensalestax-invoice-ninja

OpenSalesTax for Invoice Ninja

v0.1.0-alpha.1. Installable; passes 81 unit tests; SonarQube quality gate clean (0/0/0/0); not yet validated against a real Invoice Ninja v5 storefront. See specs/ for the build plan.

A free, self-hostable webhook sidecar that adds destination-based US sales tax to Invoice Ninja v5 invoices via the OpenSalesTax engine. No per-transaction fees, no SaaS lock-in — small agencies and freelancers self-host both Invoice Ninja and the OpenSalesTax engine on their own infrastructure.

How it works (sidecar model)

  1. Invoice Ninja fires a webhook (e.g. invoice.created) at the sidecar.
  2. The sidecar pulls the destination ZIP and line items, calls the OpenSalesTax engine, gets a calculated tax rate.
  3. The sidecar writes the rate back to the invoice via Invoice Ninja's REST API (PUT /api/v1/invoices/{id} with tax_name1/tax_rate1).

The whole loop completes in well under a second. If anything goes wrong (engine unreachable, malformed payload, non-US destination) the sidecar fails soft — the invoice is left untaxed and the operator sees a structured log line, rather than the customer seeing a broken invoice.

Why a sidecar and not a Laravel package?

Invoice Ninja v5 does not publish a stable package-extension SPI for in-process tax providers; the supported integration surfaces are its REST API and its webhook subscriber list. The sidecar pattern uses both of those — meaning it doesn't require modifying Invoice Ninja's source tree and survives Invoice Ninja upgrades without regressions. See specs/decisions/001-shape-a-vs-shape-b.md for the full architectural decision record.

What this sidecar does NOT do

Disclaimer

Tax calculations are provided as-is for convenience. The merchant is solely responsible for tax-collection accuracy and remittance to the appropriate jurisdictions. Verify against your state Department of Revenue before remitting.

Compatibility matrix

Component Tested Notes
Invoice Ninja v5 ✔ (alpha — live-test pending) v4 is EOL and unsupported.
OpenSalesTax engine v0.55.x Tracks the engine's v1 HTTP API.
PHP 8.1, 8.2, 8.3 CI matrix.
OS Linux Tested on Debian 13. Should run on any POSIX with PHP-FPM.

Install

Configure (env vars)

Var Required Default Purpose
OST_ENGINE_URL yes — Base URL of your OpenSalesTax engine (e.g. http://10.0.0.5:8080)
OST_API_KEY no — Bearer token if the engine requires auth
OST_TIMEOUT_SECONDS no 10 Outbound HTTP timeout, range (0, 60]
IN_API_URL yes — Base URL of your Invoice Ninja instance
IN_API_TOKEN yes — Invoice Ninja API token (X-Api-Token header)
IN_WEBHOOK_SIGNING_SECRET yes — HMAC-SHA256 secret shared with Invoice Ninja; min 32 chars
SIDECAR_ALLOW_PRIVATE_NETWORKS no 1 Allow RFC1918 destinations (same-VM deployment). Set 0 if exposed to the internet.
SIDECAR_REPLAY_WINDOW_SECONDS no 300 Max age of a signed webhook before it's rejected as replay, range [30, 3600]
SIDECAR_TLS_VERIFY no 1 TLS peer-verify on outbound calls
SIDECAR_RATE_LIMIT_PER_MINUTE no 120 Per-source-IP rate limit on the inbound webhook endpoint
OST_NEXUS_STATES no (empty) v0.3 (CP-3): Comma-separated US 2-letter state codes (e.g. MN,WI,IA) the merchant has nexus in. When set, the sidecar short-circuits the engine call for invoices whose ship-to state is not in the list — the webhook returns 200 with applied:false, reason:nexus_filter_skipped and Invoice Ninja's invoice stays untaxed. Empty = filter disabled (pre-v0.3 behavior). Missing / unresolvable state with the filter active is fail-closed.

Run

For development:

For production, behind nginx + PHP-FPM. The sidecar exposes two paths:

Verify engine connectivity (CLI)

Before wiring up the webhook, confirm the sidecar can reach the configured OpenSalesTax engine:

The command uses the same OST_ENGINE_URL + OST_API_KEY + SSRF URL validator as the webhook handler, so a green check here guarantees the same auth + URL path will work at webhook delivery time. Exit codes:

This is the sidecar equivalent of the "Test Connection" admin button shipped in the WooCommerce, Vendure, and Saleor connectors — same intent (catch typo'd engine URLs at deploy time instead of at first checkout), different surface (no admin UI on a headless sidecar).

Wire up the Invoice Ninja webhook

In Invoice Ninja, Settings → Integrations → Webhooks, create a subscriber:

Then sign each request with HMAC-SHA256 of t.body (Stripe-style) and include the X-Sidecar-Signature: t=<unix-seconds>,v1=<hex-digest> header. Unsigned requests are rejected with 401.

Invoice Ninja v5's stock webhook subscriber emits unsigned POSTs, so this repo ships a companion Laravel signing shim that closes the gap — see middleware/ (Composer package: ejosterberg/opensalestax-invoice-ninja-shim). One-line install:

Walkthrough in middleware/docs/SHIM-INSTALL.md.

Security

The sidecar exposes an inbound HTTP endpoint and writes back to Invoice Ninja with admin credentials, so it has a meaningful threat surface. The full threat model and mitigations are in docs/SECURITY-REVIEW.md. Key defenses:

Calculation-only

This sidecar calculates. The merchant remits.

Development

See CONTRIBUTING.md for the DCO sign-off requirement and quality gate.

License

Dual-licensed under your choice of LICENSE.

Related projects


All versions of opensalestax-invoice-ninja with dependencies

PHP Build Version
Package Version
Requires php Version >=8.2
ext-json Version *
ejosterberg/opensalestax Version ^0.3.0
guzzlehttp/guzzle Version ^7.8
psr/log Version ^1.0 || ^2.0 || ^3.0
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 ejosterberg/opensalestax-invoice-ninja contains the following files

Loading the files please wait ...