This small library for Symfony sends requests to the GoogleMaps Places autocomplete.
Make sure Composer is installed globally, as explained in the installation chapter of the Composer documentation.
Open a command console, enter your project directory and execute:
composer require netbrothers-gmbh/nb-google-api
Open a command console, enter your project directory and execute the following command to download the latest stable version of this bundle:
composer require netbrothers-gmbh/nbcsb-bundle
Then, enable the bundle by adding it to the list of registered bundles
in the config/bundles.php
file of your project:
// config/bundles.php
return [
// ...
NetBrothers\NbGoogleApiBundle\NbGoogleApiBundle::class => ['all' => true],
];
- Copy
install/config/packages/netbrothers_google_api.yaml
to symfony's config path - Add required values to your
.env
(have a look into install/env.default):
###> netbrothers-gmbh/netbrothers_google_api ###
NB_GOOGLE_API_ENABLE=1
NB_GOOGLE_API_PLACES_AUTOCOMPLETE_URI=https://maps.googleapis.com/maps/api/place/autocomplete/
NB_GOOGLE_API_PLACES_AUTOCOMPLETE_REQUEST_TYPE=json
NB_GOOGLE_PLACES_AUTOCOMPLETE_API_KEY=YOUR_API_KEY
###< netbrothers-gmbh/netbrothers_google_api ###
- Clear symfony's cache.
For a first view just run the example command bin/console netbrothers:example:google-autocomplete
.
Also have a look into example/ExampleController.php
Stefan Wessel, NetBrothers GmbH
MIT