Universal API

In an effort to smooth the development process, you can effectively call the exact same methods across various programming languages. Whether you are working in JavaScript, Twig, or PHP, the commands to create a map are all nearly identical.

Take a look at the following examples to see how the same concepts translate across different languages.

# Practical Examples

Switch between languages to see the similarities...

# Basic Map

const map = mapbox.map(locations, options);

# Complex Map

const map = mapbox.map()
    .markers(locations, options)
    .style(mapStyle)
    .center(coords)
    .zoom(level);

You'll notice that we are chaining methods together in order to build a map. There are several methods in the API, which can be chained in any order necessary.

To get a better understanding of how it works, read more on Chaining.

# Supported Languages

The following programming languages are currently supported. To see how to use these methods across each language, click on any of the links below...

# JavaScript

# Twig

# PHP