Laravel Mapbox, easily integrate Mapbox inside your Laravel app

I have just released Laravel Mapbox, a Laravel package that allows you to add Mapbox to your views easily, with highly flexibility.
It requires Laravel 8 and PHP 8.0 and up.

Before installing the package, create a Mapbox account to get your token.

Installation

To install the package, all you have to do is run this command

composer require koossaayy/laravel-mapbox

After the installation, add this key to the .env file

MAPBOX_TOKEN={your mapbox token here}

And lastly publish the config file using this command :

php artisan vendor:publish --tag="mapbox-config"

Also don't forget to add CSS and JS files of Mapbox

<link href='https://api.mapbox.com/mapbox-gl-js/v2.6.0/mapbox-gl.css' rel='stylesheet' />
<script src='https://api.mapbox.com/mapbox-gl-js/v2.6.0/mapbox-gl.js'></script>

And that's It you're good to go

Usage

To show a map on a page, all you have to do is use :

<x-mapbox id="map" />

The package comes with a lot with other options, like markers, popups, interactivity, and a lot.
You may check them here

If you like the package, give it a star, and everyone is more than welcome to contribute ♥

51