Lue dans les fichiers PHP du paquet au commit 0d6279a9e129 : ses espaces de noms, classes, interfaces et énumérations, leurs constantes, propriétés et méthodes publiques avec leur PHPDoc, et les options que prennent ses fabriques. Rien n’en est exécuté.
MapLibreFactoryclassMapLibre, from its options:
9 options · 1 method · 6 constants
MapLibreProviderclassMapLibre: the live map drawn by MapLibre GL JS (assets/maplibre.js) from a vector style - OpenFreeMap's by default, any MapLibre style by its URL.
9 methods
StyleclassA MapLibre style read on the server (https://maplibre.org/maplibre-style-spec/): its sources, glyphs and sprite, and the hosts they make a visitor's browser reach - what a consent banner and a Content-Security-Policy must name, and what MapLibreProvider::capabilities()->browserHosts should hold.
3 methods · 3 properties
Omnimap\MapLibre
MapLibreFactory class
final class MapLibreFactory extends ProviderFactory MapLibreFactory.php:29
MapLibre, from its options:
style the MapLibre style's URL (a style JSON: its vector tiles, glyphs and sprite). The default is OpenFreeMap's "liberty" style: free, without a key, without cookies attribution as HTML, shown on the map (the default: OpenFreeMap, OpenMapTiles and the OpenStreetMap contributors, as the data's licence requires) hosts the hosts the visitor's browser reaches for the style, its tiles, glyphs and sprite - comma separated or a list; the style's own host by default. Style::hosts() reads them from the style itself: check them when you change it library_script, library_style, library_script_integrity, library_style_integrity where the browser gets MapLibre GL JS (unpkg, 5.24.0, with its SHA-384 hashes): serve your own copy to keep the visitor's browser off a CDN library_module an ES module instead (MapLibre GL JS 6 is published as modules only); no integrity check is possible on what it imports, so the script stays the default preserve_drawing_buffer true (the default) lets assets/capture.js take the live map's picture
The HTTP client is only for Style (reading a style's hosts on the server); drawing needs none.
Options
| Option | Default | |
|---|---|---|
style | self::OPENFREEMAP_STYLE | |
attribution | self::OPENFREEMAP_ATTRIBUTION | |
hosts | [] | |
library_script | self::LIBRARY_SCRIPT | |
library_script_integrity | self::LIBRARY_SCRIPT_INTEGRITY | |
library_style | self::LIBRARY_STYLE | |
library_style_integrity | self::LIBRARY_STYLE_INTEGRITY | |
library_module | '' | |
preserve_drawing_buffer | true |
const OPENFREEMAP_STYLE = 'https://tiles.openfreemap.org/styles/liberty'const OPENFREEMAP_ATTRIBUTION = '<a href="https://openfreemap.org" target="_blank">OpenFreeMap</a> <a href="https://www.openmaptiles.org/" target="_blank">© OpenMapTiles</a> Data from …const LIBRARY_SCRIPT = 'https://unpkg.com/maplibre-gl@5.24.0/dist/maplibre-gl.js'const LIBRARY_SCRIPT_INTEGRITY = 'sha384-5+cfbwT0iiub6VsQAdn6yz16nr6sDiQoHx6tm4O8OVYXHYOxcffFmCJBL0dgdvGp'const LIBRARY_STYLE = 'https://unpkg.com/maplibre-gl@5.24.0/dist/maplibre-gl.css'const LIBRARY_STYLE_INTEGRITY = 'sha384-uTttxo/aOKbdE5RlD/SPzSDoDmNvGlUYPjONi2MN/b7c9HPSvW07OIuyP7uL6jxK'
MapLibreFactory::__construct()
public function __construct(readonly ?HttpClientInterface $http = null)MapLibreProvider class
final class MapLibreProvider implements MapRendererInterface MapLibreProvider.php:24
MapLibre: the live map drawn by MapLibre GL JS (assets/maplibre.js) from a vector style - OpenFreeMap's by default, any MapLibre style by its URL.
Only a renderer: vector tiles are drawn by the browser's WebGL, not by PHP, so the server makes no image of a view (no StaticMapInterface) and serves no raster tiles (no TileSourceInterface). Its picture still reaches omnimap's map cache, captured in the browser (assets/capture.js; the map keeps its drawing buffer for it).
MapView::options('maplibre')['map'] - MapLibre's map options, as JSON - is the only view option of its own.
MapLibreProvider::__construct()
public function __construct(readonly string $style = MapLibreFactory::OPENFREEMAP_STYLE, readonly string $attribution = MapLibreFactory::OPENFREEMAP_ATTRIBUTION, readonly array $hosts = [], readonly array $library = [], readonly bool $preserveDrawingBuffer = true, readonly ?HttpClientInterface $http = null)MapLibreProvider::getName()
public function getName(): stringMapLibreProvider::getTitle()
public function getTitle(): stringMapLibreProvider::capabilities()
public function capabilities(): CapabilitiesMapLibreProvider::describe()
public function describe(MapView $view): arrayMapLibreProvider::fingerprint()
public function fingerprint(MapView $view): stringMapLibreProvider::attribution()
public function attribution(): stringMapLibreProvider::style()
public function style(): stringThe style's URL.
MapLibreProvider::inspect()
public function inspect(): StyleThe style read on the server: what it makes the browser reach (Style::hosts()).
- Throws
NotSupportedException without the factory's HTTP client
Style class
final readonly class Style Style.php:17
A MapLibre style read on the server (https://maplibre.org/maplibre-style-spec/): its sources, glyphs and sprite, and the hosts they make a visitor's browser reach - what a consent banner and a Content-Security-Policy must name, and what MapLibreProvider::capabilities()->browserHosts should hold.
public string $urlpublic array $stylethe style JSON
public array $sourceseach source's tile URLs, its TileJSON read when it has one
Style::__construct()
public function __construct(public string $url, public array $style, public array $sources)$stylethe style JSON
$sourceseach source's tile URLs, its TileJSON read when it has one
Style::fetch()
public static function fetch(HttpClientInterface $http, string $url): selfReads a style, and the TileJSON of each source that names one.
Style::hosts()
public function hosts(): arrayThe hosts the browser reaches: the style's, its sources' (and their TileJSON's), its glyphs', its sprite's.