netbrothers-gmbh/nb-googleapi-bundle

SymfonyBundle for calling GoogleMaps

dev-main 2024-05-23 11:13 UTC

This package is auto-updated.

Last update: 2024-05-23 11:38:16 UTC


README

This small library for Symfony sends requests to the GoogleMaps Places autocomplete.

Installation

Make sure Composer is installed globally, as explained in the installation chapter of the Composer documentation.

Applications that use Symfony Flex

Open a command console, enter your project directory and execute:

composer require netbrothers-gmbh/nb-google-api

Applications that don't use Symfony Flex

Step 1: Download the Bundle

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

Step 2: Enable the 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],
];

Configuration

  1. Copy install/config/packages/netbrothers_google_api.yaml to symfony's config path
  2. 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 ###
  1. Clear symfony's cache.

Usage

For a first view just run the example command bin/console netbrothers:example:google-autocomplete. Also have a look into example/ExampleController.php

Author

Stefan Wessel, NetBrothers GmbH

nb.logo

Licence

MIT