Example Bridges
Hyvä POS is in closed beta
Hyvä POS is currently in a closed beta (pilot phase) with a small group of merchants. It is not yet generally available: the App Store release follows the pilot, and features and configuration may still change - possibly in backwards-incompatible ways - before the general release. Want to take part? Sign up at hyva.io/pos.
Two complete, intentionally small bridges ship as starting points:
- Example price bridge: a working customer-pricing resolver that serves per-customer prices with a quantity-tier model. Shows the resolver contract, DI registration and the shape of a pricing response.
- Example validator bridge: a working customer validator that validates postcodes against country patterns, in both validate-only and update modes. Shows the validator pool contract end to end.
Both are structured the way a real bridge should be: one provider class implementing the contract, DI registration in the pool, and conformance tests subclassed from the kit. Clone the one closest to your feature and replace the internals with calls to your module. Two provider pages walk them file by file: Customer Validators covers the validator bridge, Customer Pricing Resolvers covers the price bridge.
What Is Inside
Every file in an example exists for a reason a real bridge shares - this is the validator bridge:
magento2-hyva-pos-example-validator-bridge/
├── composer.json # magento2-module type, autoloads registration.php
├── README.md # the contract rules, file by file, heavily annotated
├── phpunit.xml.dist # standalone test config
├── src/
│ ├── registration.php # where a real bridge adds its vendor guard
│ ├── etc/
│ │ ├── module.xml # sequence: after Hyva_Pos
│ │ └── di.xml # pool registration, annotated
│ └── Model/Customer/Validator/
│ └── ExamplePostcodeCountryValidator.php
└── tests/
├── bootstrap.php
└── unit/
├── ExamplePostcodeCountryValidatorTest.php
└── ExamplePostcodeCountryValidatorConformanceTest.php # the kit adoption
The READMEs are the most annotated files in either package: they explain not just what each file does but which parts are contract and which are example filler.
Run the Tests
From the package root inside a development store (the bootstrap resolves Magento classes from the store's vendor/):
The conformance subclass is the part to keep when you adapt an example: point createProvider() at your class, rewire the arrange hooks to your vendor mocks, and the kit asserts the same contract against your bridge that it asserts against the shipped ones.
Where to Find Them
The examples are composer packages on the same private Packagist that serves the POS module, with the same credentials:
| Bridge | Package |
|---|---|
| Price bridge | hyva-themes/magento2-hyva-pos-example-price-bridge |
| Validator bridge | hyva-themes/magento2-hyva-pos-example-validator-bridge |
Require one into a development store to read the code in vendor/ and see it respond end to end:
Don't ship them to production: they are marked example-only for a reason. A bridge you ship should be your own module with the example's internals replaced. Technology partners with GitLab access can also browse the source in the hyva-pos group on the Hyvä GitLab.
Ask in the Hyvä Slack if you are building a bridge for a vendor module others might use too; bridges are exactly the kind of thing worth sharing.