Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Google Map Laravel Package

arcasolutions/google-map

Laravel package providing Google Maps integration for your app, with helpers to generate map views and include the required scripts. Useful for quickly embedding maps and configuring markers or map options within Laravel projects.

View on GitHub
Deep Wiki
Context7

Business Account

When using a service for business purpose, you will receive a business account from Google. This one allows you to bypass Google limitation according to your billing plan. In order to use this feature, you will need an Ivory\GoogleMap\Services\BusinessAccount:

use Ivory\GoogleMap\Services\BusinessAccount;

$businessAccount = new BusinessAccount('client_id', 'secret');

$clientId = $businessAccount->getClientId();
$businessAccount->setClientId($clientId);

$secret = $businessAccount->getSecret();
$businessAccount->setSecret($secret);

Note that the client identifier is not prefixed by gme- (it is automatically prepended by the library).

Additionally, you can use channel:

$businessAccount = new BusinessAccount('client_id', 'secret', 'my_channel');

$channel = $businessAccount->getChannel();
$businessAccount->setChannel($channel);

Geocoder

If you want to use the geocoder service with a Google business account, you need to set it on the provider and then, everything is done automatically:

use Ivory\GoogleMap\Services\BusinessAccount;
use Ivory\GoogleMap\Services\Geocoding\Geocoder;
use Ivory\GoogleMap\Services\Geocoding\GeocoderProvider;
use Geocoder\HttpAdapter\CurlHttpAdapter;


$provider = new GeocoderProvider(new CurlHttpAdapter())

$provider->setBusinessAccount(new BusinessAccount('client_id', 'secret'));
$businessAccount = $provider->getBusinessAccount();

$geocoder = new Geocoder();
$geocoder->registerProviders(array($provider));

$response = $geocoder->geocode('1600 Amphitheatre Parkway, Mountain View, CA');

If you want to go back the normal behavior (anonymous), you need to reset the business account to null:

$geocoder->setBusinessAccount(null);

Directions

If you want to use the directions service with a Google business account, you need to set it on the service and then, everything is done automatically:

use Ivory\GoogleMap\Services\BusinessAccount;

$directions->setBusinessAccount(new BusinessAccount('client_id', 'secret'));
$businessAccount = $directions->getBusinessAccount();

$response = $directions->route('Lille', 'Paris')

If you want to go back the normal behavior (anonymous), you need to reset the business account to null:

$directions->setBusinessAccount(null);

Distance Matrix

If you want to use the distance matrix service with a Google business account, you need to set it on the service and then, everything is done automatically:

use Ivory\GoogleMap\Services\BusinessAccount;

$distanceMatrix->setBusinessAccount(new BusinessAccount('client_id', 'secret'));
$businessAccount = $distanceMatrix->getBusinessAccount();

$response = $distanceMatrix->process(array('Vancouver BC'), array('San Francisco'));

If you want to go back the normal behavior (anonymous), you need to reset the business account to null:

$distanceMatrix->setBusinessAccount(null);
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
terminal42/code-quality-tools
codifyo/ts-generator-bundle
andydefer/laravel-cluster
testo/fiber
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity
christhompsontldr/laravel-inky