PHPackages                             thomsult/laravel-mapbox - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. thomsult/laravel-mapbox

ActiveLibrary

thomsult/laravel-mapbox
=======================

Laravel package pour les appels API Mapbox (geocoding, directions, etc.)

00PHPCI passing

Since Oct 7Pushed 7mo agoCompare

[ Source](https://github.com/thomsult/laravel-mapbox)[ Packagist](https://packagist.org/packages/thomsult/laravel-mapbox)[ RSS](/packages/thomsult-laravel-mapbox/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Laravel Mapbox
==============

[](#laravel-mapbox)

Un package Laravel élégant et typé pour intégrer les APIs Mapbox (geocoding, search, directions) dans vos applications Laravel.

✨ Fonctionnalités
-----------------

[](#-fonctionnalités)

- 🎯 **API typée** - Auto-complétion complète et type safety
- 🚀 **Fluent API** - Interface intuitive
- 🔧 **Configuration simple** - Prêt à l'emploi en quelques minutes
- 📍 **Support complet** - Search Box API, Geocoding API
- ⚡ **Laravel intégré** - Service Provider, Facade, Configuration, Cache, Rate Limiting, Lock
- 🧪 **Testé** - Tests unitaires et d'intégration

[![Laravel Package CI](https://github.com/thomsult/laravel-mapbox/actions/workflows/laravel.yml/badge.svg)](https://github.com/thomsult/laravel-mapbox/actions/workflows/laravel.yml)

📋 Prérequis
-----------

[](#-prérequis)

- PHP 8.1+
- Laravel 12.0+
- Token d'accès Mapbox

🚀 Installation
--------------

[](#-installation)

Installez le package via Composer :

```
composer require thomsult/laravel-mapbox
```

Publiez le fichier de configuration :

```
php artisan vendor:publish --provider="Thomsult\LaravelMapbox\Providers\MapboxServiceProvider" --tag="config"
```

Ajoutez votre token Mapbox dans votre fichier `.env` :

```
MAPBOX_ACCESS_TOKEN=votre_token_mapbox_ici
```

🔧 Configuration
---------------

[](#-configuration)

Le fichier de configuration `config/mapbox.php` permet de personnaliser :

```
return [
    'access_token' => env('MAPBOX_ACCESS_TOKEN'),
    'base_uri' => 'https://api.mapbox.com/',
    'debug' => env('MAPBOX_DEBUG', false),
    'cache' => [
        'enabled' => env('MAPBOX_CACHE_ENABLED', true),
        'duration' => env('MAPBOX_CACHE_DURATION', 15),
        'timeout' => env('MAPBOX_CACHE_TIMEOUT', 5)
    ],
    'rate' => [
        'enabled' => env('MAPBOX_RATE_ENABLED', true),
        'limit' => env('MAPBOX_RATE_LIMIT', 60),
        'decay' => env('MAPBOX_RATE_DECAY', 60),
    ],
    'search' => [
        'api_version' => 'v1/',
        'prefix' => 'search/',
        'base_endpoint' => 'searchbox/',
        'forward_endpoint' => 'forward',
        'suggest_endpoint' => 'suggest',
        'retrieve_endpoint' => 'retrieve',
        'category_endpoint' => 'category',
        'category_list_endpoint' => 'list/category',
        'reverse_endpoint' => 'reverse',
    ],
    'geocoding' => [
        'api_version' => 'v6/',
        'prefix' => 'search/',
        'base_endpoint' => 'geocode/',
        'forward_endpoint' => 'forward',
        'reverse_endpoint' => 'reverse',
        'batch_endpoint' => 'batch'
    ]
];
```

📖 Utilisation
-------------

[](#-utilisation)

### Recherche de base

[](#recherche-de-base)

```
Artisan::command('mapbox:search {query}', function ($query) {
    $this->comment('Mapbox search command');

    $response = MapboxClient::client()
        ->autocomplete(fn($req) => $req
            ->query($query)
            ->options(fn($options) => $options
                ->types([PlaceType::PLACE->value])
                ->limit(2)
                ->country('FR')
                ->language('fr')))
        ->call();
});
dd($response); // Affiche la réponse de l'API
```

### Recherche inversée

[](#recherche-inversée)

```
Artisan::command('mapbox:search:reverse {longitude} {latitude}', function (string $longitude, string $latitude) {
    $this->comment('Mapbox search command');
    $response = MapboxClient::client()->reverse(
        fn($req) => $req
            ->longitude($longitude)
            ->latitude($latitude)
            ->options(
                fn($options) => $options
                    ->language('fr')
            )
    )
        ->call();
    dd($response);
});
```

### Recherche Groupée

[](#recherche-groupée)

```
Artisan::command('mapbox:geocoding:batch', function () {
    $this->comment('Mapbox search command');
    $response = MapboxClient::client()->batch(
        fn($req) => $req
            ->body(
                fn($body) => $body
                    ->add(
                        (new ForwardTextRequest())
                            ->query("1600 Pennsylvania Avenue NW, Washington, DC 20500, United States")
                            ->options(
                                fn($options) => $options
                                    ->types("address")
                                    ->bbox("-80, 35, -70, 40")
                                    ->limit(1)
                            )
                    )
                    ->add(
                        (new ForwardTextRequest())
                            ->query("1605 Pennsylvania Avenue NW, Washington, DC 20500, United States")
                            ->options(
                                fn($options) => $options
                                    ->types("address")
                                    ->bbox("-80, 35, -70, 40")
                                    ->limit(1)
                            )
                    )
            )
    )
        ->call();
});
```

### Types de lieux disponibles

[](#types-de-lieux-disponibles)

```
use Thomsult\LaravelMapbox\Enums\PlaceType;

    case COUNTRY = 'country';
    case REGION = 'region';
    case POSTCODE = 'postcode';
    case DISTRICT = 'district';
    case PLACE = 'place';
    case CITY = 'city';
    case LOCALITY = 'locality';
    case NEIGHBORHOOD = 'neighborhood';
    case STREET = 'street';
    case ADDRESS = 'address';
    case POI = 'poi';
    case CATEGORY = 'category';
    case UNKNOWN = 'unknown';
```

### Utilisation dans des commandes Artisan

[](#utilisation-dans-des-commandes-artisan)

```
Artisan::command('mapbox:search {query}', function ($query) {
    $this->comment('Mapbox search command');

    $response = MapboxClient::client()
        ->autocomplete(fn($req) => $req
            ->query($query)
            ->options(fn($options) => $options
                ->types([PlaceType::PLACE->value])
                ->limit(2)
                ->country('FR')
                ->language('fr')))
        ->call();
});
```

🧪 Tests
-------

[](#-tests)

### Tests unitaires

[](#tests-unitaires)

```
composer test
```

🤝 Contribution
--------------

[](#-contribution)

Les contributions sont les bienvenues ! Merci de :

1. Fork le projet
2. Créer une branche pour votre fonctionnalité
3. Commiter vos changements
4. Pousser vers la branche
5. Créer une Pull Request

📄 Licence
---------

[](#-licence)

Ce package est sous licence MIT. Voir le fichier [LICENSE](LICENSE) pour plus de détails.

🙏 Remerciements
---------------

[](#-remerciements)

- [Mapbox](https://www.mapbox.com/) pour leur excellente API
- [Laravel](https://laravel.com/) pour le framework
- La communauté open source

📞 Support
---------

[](#-support)

- 🐛 [Signaler un bug](https://github.com/thomsult/laravel-mapbox/issues)
- 💡 [Demander une fonctionnalité](https://github.com/thomsult/laravel-mapbox/issues)
- 📖 [Documentation](https://github.com/thomsult/laravel-mapbox/blob/main/README.md)

---

Créé avec ❤️ par [Sultan Thomas](https://github.com/thomsult)

###  Health Score

17

—

LowBetter than 6% of packages

Maintenance47

Moderate activity, may be stable

Popularity0

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity13

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/43a24a1b3afdd74704c2cfb5b5c95c83a24fa7ca096f64faa1eff021e59badeb?d=identicon)[thomsult](/maintainers/thomsult)

---

Top Contributors

[![thomsult](https://avatars.githubusercontent.com/u/16962047?v=4)](https://github.com/thomsult "thomsult (2 commits)")

### Embed Badge

![Health badge](/badges/thomsult-laravel-mapbox/health.svg)

```
[![Health](https://phpackages.com/badges/thomsult-laravel-mapbox/health.svg)](https://phpackages.com/packages/thomsult-laravel-mapbox)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
