Download the PHP package dynamic/silverstripe-geocoder without Composer
On this page you can find all versions of the php package dynamic/silverstripe-geocoder. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download dynamic/silverstripe-geocoder
More information about dynamic/silverstripe-geocoder
Files in dynamic/silverstripe-geocoder
Package silverstripe-geocoder
Short Description SilverStripe wrapper for Geocoder
License BSD-3-Clause
Informations about the package silverstripe-geocoder
SilverStripe Geocoder
SilverStripe wrapper for Geocoder
Requirements
- Silverstripe ^5
- dynamic/silverstripe-country-dropdown-field ^2
- geocoder-php/google-maps-provider ^4.7
- guzzlehttp/guzzle ^7.4
- php-http/guzzle7-adapter ^1.0
- php-http/message ^1.13
Installation
composer require dynamic/silverstripe-geocoder
License
See License
Example usage
Getting Started
in mysite/_config/config.yml
, apply the DataExtensions to your DataObject:
Google API Keys
You'll also need to set two Google API keys. Each key needs to have specific API libraries enabled:
geocoder_api_key
- Geocoding API
map_api_key
- Maps JavaScript API
- Maps Static API
This is primarily due to the restriction rules on Google API keys. The Geocoding key should be tied to the webserver's public IP, while the Maps API needs to be restricted to the website's domain name. Restriction rules help to prevent unauthorized users to use your keys, which can quickly use up your API requests quota.
Documentation
AddressDataExtension
The AddressDataExtension adds Address
, Address2
, City
, State
, PostalCode
, Country
, Lat
, and Lng
fields.
The Lat
and Lng
fields are read only in the cms and are automatically generated on write.
Geocoding can be disabled on a model basis by setting disable_geocoding
to true.
Static Map Image
Using $AddressMap
in a template will render the map.
$AddressMap
also has options to easily modify the width, height, and scale of the map. $AddressMap(320, 240, 1)
Map Style
The map can be styled by adding a mapStyle.json
in any of the following folders in a theme:
Styles can be generated using an online service like Styling Wizard: Google Maps APIs
Marker Image
This does not work on local due to google needing to download the image off the server.
A custom marker image can be used to match the style of the map in about the same way as the style.
An image named mapIcon
with an extension of png
, jpg
, jpeg
, or gif
can be put in any of the following folders in a theme:
DistanceDataExtension
The DistanceDataExtension should be used in conjunction with the AddressDataExtension.
The only time it is viable by itself is if the extended DataObject has Lat
and Lng
fields.
The DistanceDataExtension will add a pseudo field for distance away from an address to a DataObject.
The address to check the distance to is from the current controller initially.
This can be changed by implementing updateAddressValue($address)
on the DataObject or an extension.
Maintainers
Bugtracker
Bugs are tracked in the issues section of this repository. Before submitting an issue please read over existing issues to ensure yours is unique.
If the issue does look like a new bug:
- Create a new issue
- Describe the steps required to reproduce your issue, and the expected outcome. Unit tests, screenshots and screencasts can help here.
- Describe your environment as detailed as possible: SilverStripe version, Browser, PHP version, Operating System, any installed SilverStripe modules.
Please report security issues to the module maintainers directly. Please don't file security issues in the bugtracker.
Development and contribution
If you would like to make contributions to the module please ensure you raise a pull request and discuss with the module maintainers.
All versions of silverstripe-geocoder with dependencies
geocoder-php/google-maps-provider Version ^4.7
guzzlehttp/guzzle Version ^7.4
php-http/guzzle7-adapter Version ^1.0
php-http/message Version ^1.13
silverstripe/recipe-core Version ^5.0