# limegreentangerine/mapboxkit architecture

> Architecture diagram of the GitHub repository limegreentangerine/mapboxkit, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-02). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/limegreentangerine/mapboxkit
- Repository: https://github.com/limegreentangerine/mapboxkit

## Overview

Mapbox for Concrete CMS provides two user-facing capabilities: an editable page map block and a PHP UK geocoding helper. Administrators save a public token in the dashboard; the block exposes it through an AJAX route and renders a configurable browser map. Geocoding queries Mapbox, filters low-confidence matches, and caches successful and no-match results. The graph uses README statements for documented browser and package workflows; unsampled subsystem details are not inferred.

Main entry points: [`src/Api/Mapbox.php`](https://github.com/limegreentangerine/mapboxkit/blob/main/src/Api/Mapbox.php) (Geocoding helper), [`blocks/mapbox/view.js`](https://github.com/limegreentangerine/mapboxkit/blob/main/blocks/mapbox/view.js) (Browser map), [`blocks/mapbox/controller.php`](https://github.com/limegreentangerine/mapboxkit/blob/main/blocks/mapbox/controller.php) (Block controller), [`single_pages/dashboard/mapbox.php`](https://github.com/limegreentangerine/mapboxkit/blob/main/single_pages/dashboard/mapbox.php) (Settings form)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_admin["Package settings"]
  node_package["Package controller<br/>[controller.php]"]
  node_dashboard["Settings form<br/>[mapbox.php]"]
  node_settings_handler["Settings handler<br/>[mapbox.php]"]
  node_package_config[("Package configuration")]
end

subgraph group_maps["Map block"]
  node_block_editor["Block editor<br/>[form.php]"]
  node_block_controller["Block controller<br/>[controller.php]"]
  node_marker_storage[("Marker records<br/>[controller.php]")]
  node_block_view["Map view<br/>[view.php]"]
  node_map_script["Browser map<br/>[view.js]"]
  node_ajax_route["AJAX key route<br/>[Mapbox.php]"]
end

subgraph group_geocoding["Geocoding"]
  node_geocode_api["Geocoding helper<br/>[Mapbox.php]"]
  node_geocode_cache["Geocode cache<br/>[CachedGeocode.php]"]
  node_logger["Mapbox logger<br/>[MapboxLogger.php]"]
end

node_administrator(("Site administrator"))
node_mapbox_gl["Mapbox GL JS"]
node_visitor(("Site visitor"))
node_php_caller(("PHP application"))
node_mapbox_service["Mapbox Geocoding API"]

node_administrator -->|"configures token"| node_dashboard
node_dashboard -->|"submits settings"| node_settings_handler
node_settings_handler -->|"saves token"| node_package_config
node_package -->|"registers route"| node_ajax_route
node_package -->|"adds page"| node_dashboard
node_package_config -->|"provides token"| node_ajax_route
node_visitor -->|"views map"| node_map_script
node_block_editor -->|"submits settings"| node_block_controller
node_block_controller -->|"reads and writes"| node_marker_storage
node_block_controller -->|"sets map config"| node_block_view
node_block_view -->|"renders map"| node_map_script
node_map_script -->|"requests token"| node_ajax_route
node_map_script -->|"uses library"| node_mapbox_gl
node_php_caller -->|"calls helper"| node_geocode_api
node_geocode_api -->|"reads and writes"| node_geocode_cache
node_geocode_api -->|"requests geocoding"| node_mapbox_service
node_geocode_api -->|"logs errors"| node_logger

click node_package "https://github.com/limegreentangerine/mapboxkit/blob/main/controller.php"
click node_dashboard "https://github.com/limegreentangerine/mapboxkit/blob/main/single_pages/dashboard/mapbox.php"
click node_settings_handler "https://github.com/limegreentangerine/mapboxkit/blob/main/controllers/single_pages/dashboard/mapbox.php"
click node_block_editor "https://github.com/limegreentangerine/mapboxkit/blob/main/blocks/mapbox/form.php"
click node_block_controller "https://github.com/limegreentangerine/mapboxkit/blob/main/blocks/mapbox/controller.php"
click node_marker_storage "https://github.com/limegreentangerine/mapboxkit/blob/main/blocks/mapbox/controller.php"
click node_block_view "https://github.com/limegreentangerine/mapboxkit/blob/main/blocks/mapbox/view.php"
click node_map_script "https://github.com/limegreentangerine/mapboxkit/blob/main/blocks/mapbox/view.js"
click node_ajax_route "https://github.com/limegreentangerine/mapboxkit/blob/main/src/Ajax/Mapbox.php"
click node_geocode_api "https://github.com/limegreentangerine/mapboxkit/blob/main/src/Api/Mapbox.php"
click node_geocode_cache "https://github.com/limegreentangerine/mapboxkit/blob/main/src/Search/CachedGeocode.php"
click node_logger "https://github.com/limegreentangerine/mapboxkit/blob/main/src/Log/MapboxLogger.php"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_package,node_dashboard,node_settings_handler,node_package_config toneBlue
class node_block_editor,node_block_controller,node_marker_storage,node_block_view,node_map_script,node_ajax_route toneAmber
class node_geocode_api,node_geocode_cache,node_logger,node_mapbox_service toneMint
class node_administrator,node_mapbox_gl,node_visitor,node_php_caller toneIndigo
```

## Components

### Package settings

- [Package controller](https://github.com/limegreentangerine/mapboxkit/blob/main/controller.php): `controller.php`
- [Settings form](https://github.com/limegreentangerine/mapboxkit/blob/main/single_pages/dashboard/mapbox.php): `single_pages/dashboard/mapbox.php`
- [Settings handler](https://github.com/limegreentangerine/mapboxkit/blob/main/controllers/single_pages/dashboard/mapbox.php): `controllers/single_pages/dashboard/mapbox.php`
- **Package configuration**

### Map block

- [Block editor](https://github.com/limegreentangerine/mapboxkit/blob/main/blocks/mapbox/form.php): `blocks/mapbox/form.php`
- [Block controller](https://github.com/limegreentangerine/mapboxkit/blob/main/blocks/mapbox/controller.php): `blocks/mapbox/controller.php`
- [Marker records](https://github.com/limegreentangerine/mapboxkit/blob/main/blocks/mapbox/controller.php): `blocks/mapbox/controller.php`
- [Map view](https://github.com/limegreentangerine/mapboxkit/blob/main/blocks/mapbox/view.php): `blocks/mapbox/view.php`
- [Browser map](https://github.com/limegreentangerine/mapboxkit/blob/main/blocks/mapbox/view.js): `blocks/mapbox/view.js`
- [AJAX key route](https://github.com/limegreentangerine/mapboxkit/blob/main/src/Ajax/Mapbox.php): `src/Ajax/Mapbox.php`

### Geocoding

- [Geocoding helper](https://github.com/limegreentangerine/mapboxkit/blob/main/src/Api/Mapbox.php): `src/Api/Mapbox.php`
- [Geocode cache](https://github.com/limegreentangerine/mapboxkit/blob/main/src/Search/CachedGeocode.php): `src/Search/CachedGeocode.php`
- [Mapbox logger](https://github.com/limegreentangerine/mapboxkit/blob/main/src/Log/MapboxLogger.php): `src/Log/MapboxLogger.php`

### Other components

- **Site administrator**
- **Mapbox GL JS**
- **Site visitor**
- **PHP application**
- **Mapbox Geocoding API**

## Connections

- Site administrator → Settings form: configures token (evidence: `README.md`)
- Settings form → Settings handler: submits settings (evidence: `single_pages/dashboard/mapbox.php`)
- Settings handler → Package configuration: saves token (evidence: `controllers/single_pages/dashboard/mapbox.php`)
- Package controller → AJAX key route: registers route (evidence: `controller.php`)
- Package controller → Settings form: adds page (evidence: `controller.php`)
- Package configuration → AJAX key route: provides token (evidence: `src/Ajax/Mapbox.php`)
- Site visitor → Browser map: views map (evidence: `README.md`)
- Block editor → Block controller: submits settings (evidence: `blocks/mapbox/controller.php`)
- Block controller → Marker records: reads and writes (evidence: `blocks/mapbox/controller.php`)
- Block controller → Map view: sets map config (evidence: `blocks/mapbox/controller.php`)
- Map view → Browser map: renders map (evidence: `README.md`)
- Browser map → AJAX key route: requests token (evidence: `README.md`)
- Browser map → Mapbox GL JS: uses library (evidence: `README.md`)
- PHP application → Geocoding helper: calls helper (evidence: `README.md`)
- Geocoding helper → Geocode cache: reads and writes (evidence: `src/Api/Mapbox.php`)
- Geocoding helper → Mapbox Geocoding API: requests geocoding (evidence: `src/Api/Mapbox.php`)
- Geocoding helper → Mapbox logger: logs errors (evidence: `src/Api/Mapbox.php`)
