Skip to content

Extension points

phil/address-bundle

What an application configures, extends or listens to. The types of addresses are phil/address's, whose data the bundle reads as they are.

Configuration

OptionWhat it extends
default_countryThe country of a new address, or null to ask for it
format_urlThe endpoint the Stimulus controller reads, __COUNTRY__ standing for the country; null leaves the controller out — see Installation

Forms

PointHow
The countries offeredThe countries option of AddressType
The country of a new addressIts default_country option
The recipient's fieldsIts with_recipient option
LabelsThe phil_address translation domain: an application's translations override the shipped ones
More than the form doesA form type extension of the application's on AddressType, as on any Symfony form type

See Forms.

The Stimulus controller

phil--address-bundle--address dispatches changed, with the country's format, once the fields follow a new country, and failed, with the error, when the format cannot be read: an application's controller listens to them to fill or show more.

Validation and storage

PointHow
Rules beyond the country'sA constraint of the application's beside ValidAddress, which checks what the country's format says
Where an address is keptThe phil_address column type, JSON through AddressArray — see Validation and storage

Twig

address, address_lines, address_label, country_name and address_schema write what phil/address gives; a layout of the application's own reads address_lines and places each line itself — see Twig.