https://github.com/bluevertex/mapbox-api-laravel
A Laravel 5+ Package for managing Mapbox Datasets and Tilesets
https://github.com/bluevertex/mapbox-api-laravel
laravel laravel-5-package laravel-framework laravel-package mapbox mapbox-api
Last synced: 11 months ago
JSON representation
A Laravel 5+ Package for managing Mapbox Datasets and Tilesets
- Host: GitHub
- URL: https://github.com/bluevertex/mapbox-api-laravel
- Owner: BlueVertex
- License: mit
- Created: 2017-12-09T21:41:17.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2024-10-12T18:19:51.000Z (over 1 year ago)
- Last Synced: 2024-11-15T08:16:33.920Z (over 1 year ago)
- Topics: laravel, laravel-5-package, laravel-framework, laravel-package, mapbox, mapbox-api
- Language: PHP
- Size: 19.5 KB
- Stars: 1
- Watchers: 3
- Forks: 5
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Mapbox API for Laravel 5+
[](https://travis-ci.org/BlueVertex/mapbox-api-laravel)
[](https://packagist.org/packages/bluevertex/mapbox-api-laravel)
[](https://packagist.org/packages/bluevertex/mapbox-api-laravel)
[](https://packagist.org/packages/bluevertex/mapbox-api-laravel)
[](https://packagist.org/packages/bluevertex/mapbox-api-laravel)
A [Laravel](https://laravel.com/) 5+ Package for managing [Mapbox](https://www.mapbox.com/api-documentation/) Datasets and Tilesets
This library supports the listing, creation, and deletion of the following types via the Mapbox API:
1. [Datasets](https://www.mapbox.com/api-documentation/#datasets)
2. [Tilesets](https://www.mapbox.com/api-documentation/#tilesets)
3. [Uploads](https://www.mapbox.com/api-documentation/#uploads)
## Installation
**Install Via Composer:**
```
composer require bluevertex/mapbox-api-laravel
```
**Laravel 5.5+**
The service provider should be automatically registered.
**Laravel ≤ 5.4:**
```
// Laravel: config/app.php
BlueVertex\MapBoxAPILaravel\MapBoxAPILaravelServiceProvider::class
```
```
// Facade Alias
'Mapbox' => BlueVertex\MapBoxAPILaravel\Facades\Mapbox::class,
```
**Lumen:**
```
// bootstrap/app.php:
$app->register(BlueVertex\MapBoxAPILaravel\MapBoxAPILaravelServiceProvider::class);
$app->withFacades(true, [
'BlueVertex\MapBoxAPILaravel\Facades\Mapbox' => 'Mapbox'
]);
```
## Configuration
Add the following to your `.env` file:
```
MAPBOX_ACCESS_TOKEN=[Your Mapbox Access Token]
MAPBOX_USERNAME=[Your Mapbox Username]
```
*Note: Make sure your Access Token has the proper scope for all the operations you need to perform.*
## Usage
### Datasets
**List Datasets:**
```
$list = Mapbox::datasets()->list();
```
**Create Dataset:**
```
$dataset = Mapbox::datasets()->create([
'name' => 'My Dataset',
'description' => 'This is my dataset'
]);
```
**Retrieve Dataset:**
```
$dataset = Mapbox::datasets($datasetID)->get();
```
**Update Dataset:**
```
$dataset = Mapbox::datasets($datasetID)->update([
'name' => 'My Dataset Updated',
'description' => 'This is my latest dataset'
]);
```
**Delete Dataset:**
```
$response = Mapbox::datasets($datasetID)->delete();
```
**List Feature:**
```
$response = Mapbox::datasets($datasetID)->features()->list();
```
**Insert or Update Feature:**
```
$response = Mapbox::datasets($datasetID)->features()->add($feature);
```
**Retrieve Feature:**
```
$response = Mapbox::datasets($datasetID)->features($featureID)->get();
```
**Delete Feature:**
```
$response = Mapbox::datasets($datasetID)->features($featureID)->delete();
```
### Tilesets
**List Tilesets:**
```
// Options array is optional
$list = Mapbox::tilesets()->list([
'type' => 'raster',
'visibility' => 'public',
'sortby' => 'modified',
'limit' => 500
]);
```
### Uploads
**Get S3 Credentials:**
```
// Returns S3Credentials Object
$response = Mapbox::uploads()->credentials();
```
**Create Upload:**
```
$response = Mapbox::uploads()->create([
'tileset' => '{username}.mytilesetid',
'url' => 'mapbox://datasets/{username}/{dataset}', // Or S3 Bucket URL from S3Credentials Object
'name' => 'Upload Name'
]);
```
**Retrieve Upload Status:**
```
$response = Mapbox::uploads($uploadID)->get();
```
**List Upload Statuses:**
```
$list = Mapbox::uploads()->list();
```
**Delete Upload:**
```
$response = Mapbox::uploads($uploadID)->delete();
```