PHP code example of bakerkretzmar / laravel-mapbox

1. Go to this page and download the library: Download bakerkretzmar/laravel-mapbox library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

bakerkretzmar / laravel-mapbox example snippets


$datasets = Mapbox::datasets()->list();

$dataset = Mapbox::datasets($dataset_id)->get();

$dataset = Mapbox::datasets()->create();
// or
$dataset = Mapbox::datasets()->create([
    'name' => 'My Dataset',
    'description' => 'A new Mapbox Dataset',
]);

$dataset = Mapbox::datasets($dataset_id)->update([
    'name' => 'My Updated Dataset',
    'description' => 'An updated Mapbox Dataset',
]);

Mapbox::datasets($dataset_id)->delete();

$features = Mapbox::datasets($dataset_id)->features()->list();
// or
$features = Mapbox::features($dataset_id)->list();

$feature = Mapbox::datasets($dataset_id)->features($feature_id)->get();
// or
$feature = Mapbox::features($dataset_id, $feature_id)->get();

$feature = Mapbox::datasets($dataset_id)->features()->add($feature);
// or
$feature = Mapbox::features($dataset_id)->add($feature);

Mapbox::datasets($dataset_id)->features($feature_id)->delete();
// or
Mapbox::features($dataset_id, $feature_id)->delete();

$tilesets = Mapbox::tilesets()->list();

Mapbox::tilesets($tileset)->delete();

$credentials = Mapbox::uploads()->credentials();

$upload = Mapbox::uploads()->create([
    'tileset' => 'my_tileset_name',
    'url' => 'http://{bucket}.s3.amazonaws.com/{key}',
    'name' => 'My Tileset',
]);
// or
$upload = Mapbox::uploads()->create([
    'tileset' => 'my_tileset_name',
    'dataset' => 'my_dataset_id',
    'name' => 'My Tileset',
]);

$upload = Mapbox::uploads($upload_id)->get();

$uploads = Mapbox::uploads()->list();

Mapbox::uploads($upload_id)->delete();
bash
php artisan vendor:publish --provider="bakerkretzmar\LaravelMapbox\LaravelMapboxServiceProvider"