PHPackages                             innoweb/silverstripe-googlemapfield - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. innoweb/silverstripe-googlemapfield

ActiveSilverstripe-vendormodule[Utility &amp; Helpers](/categories/utility)

innoweb/silverstripe-googlemapfield
===================================

Save locations using latitude/longitude DataObject fields.

3.0.1(7mo ago)223.0k↑12%31BSD-3-ClausePHP

Since May 17Pushed 7mo ago1 watchersCompare

[ Source](https://github.com/xini/silverstripe-googlemapfield)[ Packagist](https://packagist.org/packages/innoweb/silverstripe-googlemapfield)[ Docs](https://github.com/xini/silverstripe-googlemapfield)[ RSS](/packages/innoweb-silverstripe-googlemapfield/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (1)Versions (10)Used By (1)

silverstripe-googlemapfield
===========================

[](#silverstripe-googlemapfield)

*This is a SS 5 &amp; 6 compatible fork of .*

Lets you record a precise location using latitude/longitude/zoom fields to a DataObject.

Displays a map using the Google Maps API. The user may then choose where to place the marker; the landing coordinates are then saved.

You can also search for locations using the search box, which uses the Google Maps Geocoding API.

Supports SilverStripe 6

Usage
-----

[](#usage)

### Minimal configuration

[](#minimal-configuration)

Given your DataObject uses the field names `Latitude` and `Longitude` for storing the latitude and longitude respectively then the following is a minimal setup to have the map show in the CMS:

```
use SilverStripe\ORM\DataObject;
use BetterBrief\GoogleMapField;

class Store extends DataObject
{
    private static $db = [
        'Title' => 'Varchar(255)',
        'Latitude' => 'Varchar',
        'Longitude' => 'Varchar',
    ];

    public function getCMSFields() {
        $fields = parent::getCMSFiels();

        // remove the lat / lng fields from the CMS
        $fields->removeByName([
            'Latitude',
            'Longitude'
        ]);

        // add the map field
        $fields->addFieldToTab('Root.Main', GoogleMapField::create(
            $this,
            'Location'
        ));

        return $fields;
    }
}
```

Remember to set your API key in your site's `config.yml`

```
BetterBrief\GoogleMapField:
  api_key: '[google-api-key]'
```

or through `.env`

```
APP_GOOGLE_MAPS_KEY=[google-api-key]

```

Optional configuration
----------------------

[](#optional-configuration)

### Configuration options

[](#configuration-options)

You can either set the default options in your yaml file (see [\_config/googlemapfield.yml](_config/googlemapfield.yml)for a complete list) or at run time on each instance of the `GoogleMapField` object.

#### Setting at run time

[](#setting-at-run-time)

To set options at run time pass through an array of options (3rd construct parameter):

```
use BetterBrief\GoogleMapField;

$field = GoogleMapField::create(
    $dataObject,
    'FieldName',
    [
        'show_search_box' => false,
        'map' => [
            'zoom' => 10,
        ],
        ...
    ]
);
```

#### Customising the map appearance

[](#customising-the-map-appearance)

You can customise the map's appearance by passing through settings into the `map` key of the `$options` (shown above). The `map` settings take a literal representation of the [google.maps.MapOptions](https://developers.google.com/maps/documentation/javascript/reference?csw=1#MapOptions)

For example if we wanted to change the map type from a road map to satellite imagery we could do the following:

```
use BetterBrief\GoogleMapField;

$field = GoogleMapField::create(
    $object,
    'Location',
    [
        'map' => [
            'mapTypeId' => 'SATELLITE',
        ],
    ]
);
```

Getting an API key
==================

[](#getting-an-api-key)

Google Maps API key
-------------------

[](#google-maps-api-key)

To get a Google Maps JS API key please see [the official docs](https://developers.google.com/maps/documentation/javascript/get-api-key)

Geocoding access - enabling the search box
------------------------------------------

[](#geocoding-access---enabling-the-search-box)

To use the search box to find locations on the map, you'll need to have enabled the Geocoding API as well. Please see [the official docs](https://developers.google.com/maps/documentation/javascript/geocoding#GetStarted)

###  Health Score

43

—

FairBetter than 91% of packages

Maintenance62

Regular maintenance activity

Popularity32

Limited adoption so far

Community19

Small or concentrated contributor base

Maturity50

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 63.4% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~107 days

Recently: every ~153 days

Total

9

Last Release

238d ago

Major Versions

2.4.0 → 3.0.02025-09-02

### Community

Maintainers

![](https://www.gravatar.com/avatar/0d2e71d7787401a7bd4916062346163897f89f455d650ab32b5d60cd14825ad3?d=identicon)[xini](/maintainers/xini)

---

Top Contributors

[![dhensby](https://avatars.githubusercontent.com/u/563596?v=4)](https://github.com/dhensby "dhensby (45 commits)")[![xini](https://avatars.githubusercontent.com/u/1152403?v=4)](https://github.com/xini "xini (11 commits)")[![willmorgan](https://avatars.githubusercontent.com/u/168688?v=4)](https://github.com/willmorgan "willmorgan (9 commits)")[![lerni](https://avatars.githubusercontent.com/u/472115?v=4)](https://github.com/lerni "lerni (2 commits)")[![3Dgoo](https://avatars.githubusercontent.com/u/2616373?v=4)](https://github.com/3Dgoo "3Dgoo (1 commits)")[![MarkMhn](https://avatars.githubusercontent.com/u/911714?v=4)](https://github.com/MarkMhn "MarkMhn (1 commits)")[![jedateach](https://avatars.githubusercontent.com/u/1356335?v=4)](https://github.com/jedateach "jedateach (1 commits)")[![dizzystuff](https://avatars.githubusercontent.com/u/576903?v=4)](https://github.com/dizzystuff "dizzystuff (1 commits)")

---

Tags

googlegeolocationsilverstripemapmapsgooglemapfield

### Embed Badge

![Health badge](/badges/innoweb-silverstripe-googlemapfield/health.svg)

```
[![Health](https://phpackages.com/badges/innoweb-silverstripe-googlemapfield/health.svg)](https://phpackages.com/packages/innoweb-silverstripe-googlemapfield)
```

###  Alternatives

[cornford/googlmapper

An easy way to integrate Google Maps with Laravel.

457447.9k4](/packages/cornford-googlmapper)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
