Download the PHP package tearoom1/kirby-leaflet-map without Composer

On this page you can find all versions of the php package tearoom1/kirby-leaflet-map. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package kirby-leaflet-map

Kirby Leaflet Map

A map block for Kirby with markers and paths, based on Leaflet and OpenStreetMap. No API key, no Google, and with an optional tile proxy your visitors never contact a third-party server.

Features

Requirements

Installation

Composer

Git submodule

Download

Download and copy this repository to /site/plugins/leaflet-map.

Usage

Add the block to the fieldsets of your blocks or layout field:

Include the plugin's CSS and JavaScript in your templates, e.g. in the header and footer snippets:

Each map block can be configured in the panel:

  1. Title and description
  2. Display mode: embedded or a thumbnail that opens the map in an overlay
  3. Zoom levels: default, minimum and maximum
  4. Labels: set per location, always visible, on hover or only in the popup
  5. Legend: shown below the map
  6. Map style, if the site offers several (see Map styles)
  7. Locations: title, description, size (1–5), color, symbol, legend entry, label, hidden, map center
  8. Paths: name, color, label, legend entry and the line drawn on the map

Without a location marked as map center, the map shows all locations and paths. It zooms in at most to the default zoom and out below the minimum zoom if needed.

The title of a location appears as a label above the marker and in the popup when the marker is clicked, the description only in the popup. Descriptions support Kirbytext, so they can link to further information: [Opening hours](https://example.com) or (link: https://example.com text: Opening hours).

Symbols and legend

Each location can show a symbol on its marker: stop (H), bus, train, tram, bicycle, car, parking, charging station, harbour, restaurant, café, bar, accommodation, camping, shop, information, entrance, toilet, accessible, hospital, museum, church, photo spot, park, mountain, swimming, home, highlight, favourite and flag. The symbol is drawn in white, or dark on light marker colors.

The legend explains the markers and paths of the map. Locations and paths with the same legend entry share one line, e.g. "Our shops" or "Bike route". Without an entry, locations are listed by their symbol, while markers without a symbol share one line "Location" and paths one line "Path". As colors may differ within these groups, the legend shows neutral symbols. Only own legend entries whose locations or paths all have the same color show that color, e.g. "Sold out" in red.

Add your own symbols or remove built-in ones with the icons option. Symbols are SVGs with a 0 0 24 24 view box that use currentColor:

Map styles

By default all maps use the tile layer of the tiles options. With the layers option, editors can choose a style per map and allow visitors to switch between them:

The first style is the default. All presets are free OpenStreetMap based services; please respect their usage policies, or use the tile proxy, which works for all styles.

The presets cover the whole world. Official maps of a single country are often calmer and free as well, but stay empty outside of it, so they are not included as presets. Add them as own styles if your maps stay within that country, e.g. basemap.de for Germany or The National Map of the USGS for the United States. Note the {y}/{x} order in their URLs:

For basemap.de, de_basemapde_web_raster_grau gives a gray version, for the USGS, USGSImageryOnly instead of USGSTopo gives aerial images. Providers that need an API key, like Stadia Maps, Thunderforest or MapTiler, work the same way with the key in the URL; check their terms for your site.

Path editor

Paths are drawn with the leaflet-path field: click on the map to add a point, drag a point to move it and click it to remove it. It stores a list of points:

Location picker

Locations and path points are set with the leaflet-location field. Search an address, click on the map to place the marker, drag it to adjust it or enter the coordinates directly.

The field can be used in your own blueprints as well:

It stores the coordinates as lat and lng:

The address search uses Nominatim by default. Requests are sent from your server, are only available to logged-in panel users, are limited to one per second and are cached for a week, as required by the Nominatim usage policy.

Privacy

By default, map tiles are loaded from the OpenStreetMap servers, which transfers the IP address of your visitors to them. There are two ways to avoid this:

Tile proxy

Tiles are fetched by your server and stored in media/leaflet-map/tiles. From then on your web server delivers them directly, without PHP. Each map only allows the tiles around its own locations and within its zoom levels, so the proxy can't be used to download arbitrary tiles. The cache is renewed every month.

Make sure your server is allowed to connect to the tile provider and has some disk space for the tiles. For sites with a lot of traffic, use your own or a commercial tile provider (see tiles.url), the OpenStreetMap tile usage policy applies.

Load on click

Embedded maps show a notice and a "Load map" button. Nothing is loaded from the tile server until the visitor clicks it.

Configuration

All options are optional:

Option Default Description
tiles.url OpenStreetMap Tile URL template for Leaflet, any provider works
tiles.attribution OpenStreetMap Attribution shown on the map, required by most providers
tiles.maxZoom 19 Highest zoom level the tile provider offers
tiles.proxy false Load tiles through your own server (see Privacy)
tiles.userAgent plugin name and site URL User agent for requests to the tile provider and geocoder
loadOnClick false Embedded maps only load after a click (see Privacy)
geocoder true Address search in the location picker
geocoder.url Nominatim Nominatim compatible search endpoint
layers ['default'] Map styles editors can choose from (see Map styles)
icons [] Own marker symbols, false removes a built-in one (see Symbols and legend)
panel.center [20, 0] Center of the picker map while no location is set
panel.zoom 2 Zoom of the picker map while no location is set
alwaysIncludeAssets true Include CSS and JS on every page, otherwise only on pages with a map block
enabled true Set to false to stop including the plugin's CSS and JS

Texts can be changed with Kirby's translations, the keys start with tearoom1.leaflet-map.

Support

Leaflet Map is free and MIT licensed, and it stays that way. If it saves you time, you can help keep it maintained. Paying is voluntary and any amount is welcome.

Agencies and companies that need an invoice can get a Supporter License. You choose the price and whether it covers one project or your whole company. Lemon Squeezy handles the sale as merchant of record, so you get a proper invoice with VAT. The license adds no features and no priority support.

Support this plugin

License

This plugin is licensed under the MIT License

Credits

Screenshots

Dark preview

Both previews use the same Munich map at 1408 × 902 pixels. The dark preview uses site CSS to theme the OpenStreetMap tiles, labels and map controls.


All versions of kirby-leaflet-map with dependencies

PHP Build Version
Package Version
Requires getkirby/composer-installer Version ^1.1
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package tearoom1/kirby-leaflet-map contains the following files

Loading the files please wait ...