Download the PHP package atlasflow/order-bridge without Composer
On this page you can find all versions of the php package atlasflow/order-bridge. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package order-bridge
Atlas Core Order Bridge
A framework-agnostic PHP package for serialising, validating, and transporting orders between Atlas Core and host applications (ePOS, E-commerce, etc.) according to the Order Bridge API Specification v1.4.2.
Core Concepts
The package owns two things exclusively:
- Serialisation: Converting host application data into spec-compliant JSON payloads.
- Validation: Enforcing all schema and arithmetic rules defined in the specification.
It is designed to be unopinionated about persistence. It does not include Eloquent models, migrations, or database logic. Instead, it defines a set of Interfaces that your application's models must implement.
Key Components
OrderSerialiser: Takes objects implementingOrderInterfaceand produces a fully validated payload array. It handles all complex arithmetic (VAT, line totals, grand totals) usingbcmathinternally.PayloadValidator: Implements all rules from §5 of the spec, including arithmetic verification and idempotency checks.HttpTransport: A thin PSR-18 compatible layer for sending payloads to Atlas Core.InboundParser: The reverse direction—parses and validates JSON from Atlas Core into typed DTOs.TransferIdManager: Utility for generating and managingtransfer_idGUIDs to ensure idempotency.
Installation
Note: Requires PHP 8.4+ and the bcmath extension.
Usage Instructions
1. Implement the Interfaces
The package never touches your models directly. You must create "Adapters" that wrap your models and implement the interfaces in Atlasflow\OrderBridge\Contracts.
2. Serialise and Send
The OrderSerialiser computes all totals for you. You only provide raw values (quantities, unit prices, discount percentages, and VAT rates).
3. Validate a Payload
You can use the validator independently to dry-run a batch or validate inbound webhooks.
4. Parse Inbound Payloads
When receiving an export from Atlas Core, use the InboundParser to get typed DTOs.
Idempotency
The package automatically generates a transfer_id (UUID v4) during serialisation. Atlas Core uses this ID combined with your site_id to prevent duplicate order processing.
If you need to retry a failed transport attempt:
- Identical Retries: Reuse the same payload (and thus the same
transfer_id). Core will acknowledge the retry without creating duplicate records. - Modified Payloads: If the content changes, you must generate a new
transfer_idby re-serialising the order.
Laravel Integration
The package ships with a first-class Laravel service provider that handles configuration publishing and wires everything up automatically.
Auto-discovery
Laravel 5.5+ will auto-discover the service provider. No manual registration is needed.
Publish the configuration file
This copies config/order-bridge.php into your application's config/ directory.
Configuration reference
| Key | Default | Description |
|---|---|---|
tolerance |
'0.0001' |
Arithmetic tolerance for §5.3 validation checks. |
monetary_scale |
4 |
Decimal places for all monetary output fields. |
discount_scale |
6 |
Decimal places for discount percentage strings. |
vat_rounding_scale |
2 |
Decimal places to which VAT amounts are rounded before output. Set to 4 to disable the extra rounding step. |
vat_rounding_mode |
'ceil' |
Rounding direction for VAT amounts. 'ceil' rounds toward positive infinity (always up for positive values); 'floor' rounds toward negative infinity. |
Manual registration (without auto-discovery)
Add the provider to config/app.php:
Framework-agnostic usage
Outside of Laravel the package works out of the box with sensible defaults. If you need to override the defaults at runtime, call SchemaVersion::configure() early in your bootstrap:
License
The MIT License (MIT). Please see License File for more information.
All versions of order-bridge with dependencies
ext-bcmath Version *
psr/http-client Version ^1.0
psr/http-factory Version ^1.0