Download the PHP package keirontw/relay-point-bundle without Composer
On this page you can find all versions of the php package keirontw/relay-point-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download keirontw/relay-point-bundle
More information about keirontw/relay-point-bundle
Files in keirontw/relay-point-bundle
Package relay-point-bundle
Short Description Carrier-agnostic relay point (point relais) selection bundle for Symfony
License MIT
Informations about the package relay-point-bundle
Keirontw Relay Point Bundle
Carrier-agnostic relay point ("point relais") selection for any Symfony project — no e-commerce framework required. Provides a search/geocoding API, a session-backed selection store, and a ready-to-embed Stimulus widget.
Supported carriers: Mondial Relay, Chronopost, Shop2Shop, Colissimo, InPost, Colis Privé, DPD, DHL, Packeta, PostNL, Bpost, GLS.
Installation
Register the bundle in config/bundles.php (skip this step if you use Symfony Flex
and it was added automatically):
Import the shop routes in config/routes.yaml:
Configuration
Create config/packages/keirontw_relay_point.yaml and enable the carriers you need.
Every carrier is disabled by default; only enabled: true carriers get wired into the
container.
See src/DependencyInjection/Configuration.php for the full tree (every carrier's
required options) and src/Provider/** for the corresponding provider implementation.
To plug your own backend instead of Addok/Nominatim/Google/Photon, set
geocoding.provider: custom and alias the interface yourself:
To add a carrier the bundle doesn't ship, implement
Keirontw\RelayPointBundle\RelayPoint\RelayPointProviderInterface — it's
autoconfigured and auto-tagged, no manual service registration needed.
Frontend assets
The widget is a Stimulus controller. Wire it depending on your asset pipeline:
AssetMapper — nothing to do. If symfony/asset-mapper is installed, the bundle
registers its assets/shop directory (under the keirontw_relay_point namespace)
automatically via prependExtensionConfig. The controller is picked up by
symfony/stimulus-bundle's auto-discovery like any other mapped asset.
Webpack Encore — copy assets/shop/controllers/relay-point-picker_controller.js into
your own assets/controllers/ and register it in your assets/controllers.json
(or symfony_ux autodiscovery if you vendor it via a package).
The widget also expects Leaflet (L global) to be loaded on
the page for the map panel.
Embedding the widget
Include the template wherever you want the picker to render (checkout step, an admin order edit page, anywhere):
methodCodes should be the subset of your configured shipping_method_codes that are
actually active for the current order/cart (e.g. the customer's chosen shipping
method, if it's a relay-point one). The widget only searches carriers whose method
code is in that list.
See the docblock at the top of templates/shop/relay_point_picker.html.twig for the
full list of optional variables (pre-filled address, CSS variable theming) and the
Twig blocks you can override via {% embed %}.
Reading the customer's selection
The bundle does not assume any order/cart model — you decide when and how to
persist the selection. The widget POSTs to keirontw_relay_point_shop_select on
every pick, which stores it in the session via RelayPointSessionStorage.
Option A — automatic, via the built-in checkout listener
Implement RelayPointAddressApplierInterface once in your app:
Then point the bundle at your own checkout-completed event:
The bundle registers RelayPointCheckoutListener as a kernel.event_listener for
that event class. It reads the session selection, calls your applier, and clears
the session — you never touch RelayPointSessionStorage directly. Your
RelayPointAddressApplierInterface implementation must be the only service
implementing the interface (or aliased explicitly) so autowiring can find it.
Option B — manual
Skip the config above and read the storage yourself wherever you need it:
SelectedRelayPoint (returned by ->get()) exposes: id, name, street,
postcode, city, countryCode, latitude, longitude, carrierCode,
shippingMethodCode, distanceInMeters, openingHours.
Development
License
MIT
All versions of relay-point-bundle with dependencies
ext-soap Version *
symfony/framework-bundle Version ^6.4 || ^7.0
symfony/http-client Version ^6.4 || ^7.0
symfony/twig-bundle Version ^6.4 || ^7.0