Search by

A custom ConcreteCMS package for displaying maps through the Mapbox system

Package info

github.com/limegreentangerine/MapboxKit

Type:concrete5-package

pkg:composer/limegreentangerine/mapbox_kit

Statistics

Installs: 1

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

1.0.0 2026-09-28 15:36 UTC

This package is auto-updated.

Last update: 2026-09-28 15:40:59 UTC


README

SystemTests

CodeStandards

Mapbox is a Concrete CMS package that adds an editable Mapbox GL JS map block and a PHP helper for looking up UK locations with the Mapbox Geocoding API.

Requirements

  • Concrete CMS 9.5 or later
  • PHP 8.4 or later
  • The class_kit Concrete CMS package (required by this package)
  • A Mapbox public access token

The map block loads Mapbox GL JS 3.21.0 from Mapbox's CDN.

Installation

Install the package's Composer dependencies, including limegreentangerine/class_kit, using the Composer repository configured for your project. Install the package in Concrete CMS using your site's normal package deployment process. Its Concrete package handle is mapbox.

After installation, open Dashboard > Mapbox, enter a Mapbox public access token, and save the settings. You can create tokens in your Mapbox account. Use a public (pk.) token intended for browser use; the map block exposes the token to site visitors. Apply appropriate URL restrictions and scopes in Mapbox.

Map block

Add the Mapbox block to a page and configure:

  • Centre latitude and longitude, zoom, and pitch
  • A Mapbox style URL or style identifier (custom styles can be created in Mapbox Studio)
  • Whether visitors can interact with the map
  • Whether to show navigation controls and where to place them
  • Whether to show 3D buildings and their extrusion colour
  • Any number of markers, each with a latitude, longitude, and optional colour

The block obtains the configured token from /ajax/mapbox, then renders the map in the browser. A missing token is reported in the browser console and displayed on the map in the page.

PHP geocoding helper

The Mapbox\Api\Mapbox class provides getLocationDetails(string $location). In a Concrete CMS context, resolve it through the application container:

$mapbox = \Core::make(\Mapbox\Api\Mapbox::class);
$result = $mapbox->getLocationDetails('London');

The helper queries the Mapbox Geocoding API with the country restricted to gb. It returns a JSON response for the first feature when its relevance is greater than 0.7, or null when there is no confident match. An API error is returned as a JSON response with the upstream status code. Successful features and no-match results are cached for one hour by default.

Development

Install the development dependencies, then run:

composer test
composer check

composer test runs the PHPUnit suite. composer check runs PHPStan and prints findings; the configured Composer script does not fail when PHPStan reports findings.

License

This package is proprietary. See LICENSE for the terms.