Download the PHP package daften/addressing-bundle without Composer
On this page you can find all versions of the php package daften/addressing-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download daften/addressing-bundle
More information about daften/addressing-bundle
Files in daften/addressing-bundle
Package addressing-bundle
Short Description Provides an integration between commerceguys addressing package and Symfony.
License MIT
Informations about the package addressing-bundle
The Addressing Bundle
Requirements
- jQuery loaded as $
- jQuery Once loaded properly.
Installation
Add the mapping to your doctrine.yaml file:
TODO: Explain why this mapping is needed.
You'll also need to add some configuration or javascript depending on the form you'll use for address information. For
this you need to run bin/console assets:install
to copy the bundle assets to the public folder.
AddressEmbeddableType
You'll also need to add some javascript code, to make sure the form changes on changing the country code work.
The script below gives an example. You just need to initialize the javascript functionality. All address fields will automatically be covered. This only works when using Symfony 4 with Webpack Encore.
AddressEmbeddableGmapsAutocompleteType
You'll also need to add some javascript code, to make sure the autocomplete functionality works.
The script below gives an example. You just need to initialize the javascript functionality. All autocomplete address fields will automatically be covered. This only works when using Symfony 4 with Webpack Encore.
You also need to add the Google API key to the .env file with property key GMAPS_API_KEY. You can override this by overruling the service definition for daften.service.gmaps_autocomplete_service.
Usage
Entity property
You need to add an address field as an ORM Embedded property.
Entity form
AddressEmbeddableType
There are 3 additional options that can be used for this form type:
- allowed_countries: The countries allowed in the country dropdown. An array where the keys should be the country name and the values should be the 2-character country code.
- preferred_countries: An array with the preferred countries, using the 2-character country codes.
- default_country: The default country to show in the country dropdown.
An example form for the AddressExample class given above using the default AddressEmbeddableType with separate fields.
AddressEmbeddableGmapsAutocompleteType
There is 1 additional option that can be used for this form type:
- allowed_countries: The countries allowed for autocompletion. An array where the values should be the 2-character country code.
An example form for the AddressExample class given above using the AddressEmbeddableGmapsAutocompleteType with one autocomplete field.
All versions of addressing-bundle with dependencies
commerceguys/addressing Version ^2
doctrine/orm Version ^2.6
symfony/form Version ^4.4 | ^5.3 | ^6.0
symfony/framework-bundle Version ^4.4 | ^5.3 | ^6.0