Download the PHP package ejosterberg/opensalestax-sylius without Composer
On this page you can find all versions of the php package ejosterberg/opensalestax-sylius. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download ejosterberg/opensalestax-sylius
More information about ejosterberg/opensalestax-sylius
Files in ejosterberg/opensalestax-sylius
Package opensalestax-sylius
Short Description Sylius bundle: replace Sylius's built-in tax calculation with self-hosted OpenSalesTax — destination-based US sales tax.
License Apache-2.0 GPL-2.0-or-later
Homepage https://github.com/ejosterberg/opensalestax-sylius
Informations about the package opensalestax-sylius
opensalestax-sylius
Sylius bundle that replaces Sylius's built-in tax calculation with destination-based US sales tax computed by a self-hosted OpenSalesTax engine.
Free, self-hostable, no per-transaction fees, no SaaS lock-in. The merchant runs both Sylius and the OpenSalesTax engine on their own infrastructure.
Status
v0.1.0-alpha.1 — initial release. Single-line tax calculation
through a Sylius TaxCalculationStrategy, USD/US gating,
fail-soft engine error handling, optional per-state nexus filter.
Install
Register the bundle in config/bundles.php:
Add a config file at config/packages/opensalestax_sylius.yaml:
Then in Sylius admin (Configuration → Channels → <your channel> → Tax Calculation Strategy), select OpenSalesTax. Place a
test order shipping to a US ZIP — destination-based tax appears
on the order.
How it works
- Sylius invokes
OstaxTaxationStrategy::applyTaxes()once per order during checkout recalculation. - The strategy reads the destination ZIP / state / currency / country off the order's shipping address.
- For each
OrderItemUnit, it asksOstaxCalculatorfor the tax amount. The calculator gates on USD-only, US-only, nexus-state filter, then calls the OST engine viaPOST /v1/calculate. - Per-unit tax is added as an adjustment of type
taxlabeledOpenSalesTax.
Cache: each (zip, category, cents) tuple is memoized in Symfony's
cache.app PSR-6 pool for cache_ttl_seconds (default 1 hour).
Behavior matrix
| Order shape | What happens |
|---|---|
| USD, US ship-to, valid 5-digit ZIP, in-nexus | Engine called; tax adjustment added |
| Non-USD currency | 0.0 tax — Sylius's other strategies / built-in TaxRate rows handle it |
| Non-US ship-to country | 0.0 tax (constitution §5) |
| Missing or invalid ZIP | 0.0 tax |
nexus_states set + ship-to state not on list |
0.0 tax |
Engine unreachable, fail_hard: false (default) |
0.0 tax + warning logged |
Engine unreachable, fail_hard: true |
Throws — surfaces as a Sylius checkout error |
What this bundle does NOT do
- File or remit collected tax (calculation only — constitution §6)
- Validate addresses or autocomplete (out-of-scope §10)
- Handle non-USD currency or non-US ship-to (constitution §5)
- Validate exemption certificates against state DOR (§10)
- Marketplace-facilitator special handling (§10)
- Run a standalone HTTP / webhook server (constitution §2 — purely in-process; outbound calls to the engine only)
Configuration reference
| Key | Type | Default | Description |
|---|---|---|---|
engine_url |
string | (required) | Base URL of the OST engine. Must be http:// or https://. |
api_key |
string|null | null |
Optional API key (sent as X-API-Key header). |
timeout_seconds |
float | 5.0 |
Per-request timeout. |
fail_hard |
bool | false |
When true, engine errors throw and surface as Sylius errors. Default: fail-soft (return 0, log warning). |
default_category |
enum | general |
OST category sent for line items with no per-product mapping. One of general, clothing, groceries, prescription_drugs, prepared_food, digital_goods. |
nexus_states |
string[] | [] |
Allowlist of US state codes (e.g. ['MN', 'WI']). Empty = collect everywhere. |
cache_ttl_seconds |
int | 3600 |
Cache TTL for engine results. 0 disables caching. |
Compatibility
| Sylius | OST engine | This bundle |
|---|---|---|
^1.13 |
v0.14+ (v1 API) |
0.1.x |
License
Dual-licensed under your choice of:
- Apache License 2.0, OR
- GNU GPL 2.0 or later
See LICENSE for the SPDX declaration. The dual
licensing exists to keep the OpenSalesTax portfolio's licensing
footprint consistent across ecosystems.
Contributing
See CONTRIBUTING.md. DCO sign-off required on
every commit.
Disclaimer
This bundle calculates US sales tax. It does not file returns, remit collected tax, or validate exemption certificates against state DOR systems. The merchant remains responsible for filing and remittance.
All versions of opensalestax-sylius with dependencies
ext-json Version *
ejosterberg/opensalestax Version ^0.3.0
psr/cache Version ^2.0 || ^3.0
psr/log Version ^2.0 || ^3.0
symfony/config Version ^6.4 || ^7.0
symfony/dependency-injection Version ^6.4 || ^7.0
symfony/http-kernel Version ^6.4 || ^7.0