Download the PHP package devkokov/craft3-osmaps without Composer

On this page you can find all versions of the php package devkokov/craft3-osmaps. 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 craft3-osmaps

OS Maps plugin for Craft CMS 4.x

Allows you to display Ordnance Survey maps on your Craft CMS website.

Requirements

This plugin requires PHP 7.4 - 8.2 and supports Craft CMS 3.x and 4.x.

OS Maps Craft 3 Craft 4
1.x :white_check_mark: :x:
2.x :x: :white_check_mark:

Installation

To install the plugin, follow these instructions.

  1. Open your terminal and go to your Craft project:

    cd /path/to/project

  2. Then tell Composer to load the plugin:

    composer require burnthebook/craft3-osmaps

  3. In the Control Panel, go to Settings → Plugins and click the “Install” button for OS Maps.

Configuration

  1. Add your OS Maps API Key on the plugin's settings page in the Control Panel.

  2. Set a Max Zoom Level value. This is usually 10 if you are not allowed to display the OS MasterMap Topography Layer.

Using OS Maps

Add the following to your twig template and modify where necessary.

See the Leaflet Documentation for reference on using the L JavaScript object.

Note that the createOSMap() function returns a Leaflet Map object.

Advanced usage

The getApiUrl() method accepts an object with options.

See the OS Maps Documentation for more details.

The default options we define are:

If you are using Google Maps in the Control Panel (e.g. Maps plugin), you will want to convert the Google Maps zoom level to an OS Maps zoom level:

The JavaScript function createOSMap() accepts the following parameters:

The function returns a standard Leaflet Map object. Do with it as you wish.

The Leaflet library (L object in JS) is also globally exposed should you wish to use it e.g. for adding markers or manipulating the map.

A note on performance

We are proxying all tile requests via the plugin (Craft) in order to keep the OS API key hidden from the public. This isn't the best approach from a performance perspective, however it is required by OS.

To illustrate this:

Map (front-end) <--> OS Maps Plugin (Craft) <--> OS Maps API

When users interact with a map (zooming/panning) this will trigger lots of requests to your server - one request for each tile to be more precise! If you have lots of users and lots of maps on your site, this could become a problem!

A possible solution would be to place your website over a CDN e.g. CloudFlare and enable full-page caching on all requests to /actions/os-maps/api/*, where /actions/ is your actionTrigger config setting (actions by default).

Just note that you'd have to clear the CDN cache when/if OS update any tiles.

Useful resources


Brought to you by Burnthebook


All versions of craft3-osmaps with dependencies

PHP Build Version
Package Version
Requires craftcms/cms Version ^3.0.0-RC1
jenssegers/proxy Version ^3.0
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 devkokov/craft3-osmaps contains the following files

Loading the files please wait ....