Download the PHP package flaviovs/yii2-geocomplete without Composer
On this page you can find all versions of the php package flaviovs/yii2-geocomplete. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download flaviovs/yii2-geocomplete
More information about flaviovs/yii2-geocomplete
Files in flaviovs/yii2-geocomplete
Package yii2-geocomplete
Short Description jQuery Geocomplete widget for Yii2
License MIT
Informations about the package yii2-geocomplete
Yii2 Geocomplete
A geocomplete widget for Yii2 using the Geocomplete jQuery plugin.
Usage
First you need to configure Google Maps API key, This can be done by
setting the mapsApiKey property in the widget's asset bundle in your
app config:
You can use sessionToken on the asset bundle configuration to
specify the session token to be sent to Maps API (see details
here). The
extension will generate a session token by default -- set this
parameter to false to prevent this.
Notice The widget will not work properly unless you provide a valid API key. See https://developers.google.com/maps/documentation/javascript/get-api-key for more details.
Then you can add geocomplete widgets to your models fields in your views:
Yii2 Geocomplete configure the jQuery plugin to look for the
data-geocomplete attribute when address lookup is complete. This
makes easy to get other values from the address. For example, to get
the country code and postal code in separate fields, use the following
code:
Widget Options
Yii2 Geocomplete widgets accept the following options:
-
options- standard tag attributes -
container- jQuery selector of HTML container that Yii2 Geocomplete should look fordata-geocomplete-tagged elements. Default is the parent form (obtained from Javascript). geocompleteOptions- object with Geocomplete plugin options. See https://ubilabs.github.io/geocomplete/ for a complete list.