omnitrade / web
Omnitrade Web: any product page read from its own markup - JSON-LD Product (and ProductGroup), microdata, OpenGraph - as an Omnitrade Product, and affiliate links by host.
Requires
- php: >=8.2
- ext-dom: *
- ext-libxml: *
- omnisense/omnitrade: ^1.0@dev
- symfony/http-client: ^6.4|^7.0|^8.0
Requires (Dev)
- phpunit/phpunit: ^11.0
Suggests
None
Provides
None
Conflicts
None
Replaces
None
This package is auto-updated.
Last update: 2026-10-26 10:04:50 UTC
README
Any product page for omnisense/omnitrade: the page is
fetched and its own markup read as an Omnitrade Product - the JSON-LD Product (or
ProductGroup and its variants) most shops publish for search engines, else schema.org
microdata, else the OpenGraph tags. No account, no key. And affiliate links, by host.
$gateway = (new WebGatewayFactory($http))->create([]); // $http: the application's HTTP client; none given, the factory makes its own
No framework needed: the package requires omnisense/omnitrade and symfony/http-client. In a
Symfony application, the same through the bundle's configuration:
omnitrade: gateways: web: factory: web options: currency: EUR # a price found without a currency affiliate: # host (or a suffix of it) => query parameters amazon.fr: { tag: 'mysite-21' } fnac.com: { awc: '1234_5678' }
$product = $registry->get('web')->fetchProduct('https://boutique.example/p/poussette-yoyo'); $product->title; $product->brand; $product->price(); $product->media[0]->url; $product->merchant->name; $registry->get('web')->affiliateLink('https://www.amazon.fr/dp/B0C1234567?psc=1'); // …/dp/B0C1234567?tag=mysite-21
Nothing is bought here: supports(Purchase::class) is false, as for FetchProducts and
FetchInventory (the web is not a catalogue to page through). See
the manual, docs/index.md (the options, the addresses read, affiliate links,
errors), and docs/reading-a-page.md for what is read where and the
limits (pages drawn by JavaScript, shops that refuse robots).
Addresses are pasted by anyone: only http(s) is read, at most max_bytes, and never a machine
of the local network unless allow_private says so.
License: MIT since 2026-10-09; earlier versions remain published under LGPL-3.0-or-later.