assoconnect / mapbox-token
PHP client for Mapbox Token API
Installs: 8 358
Dependents: 0
Suggesters: 0
Security: 0
Stars: 4
Watchers: 11
Forks: 0
Open Issues: 0
Requires
- guzzlehttp/guzzle: ^6.3
Requires (Dev)
- phpunit/phpunit: ^7.5
This package is auto-updated.
Last update: 2024-10-29 05:10:26 UTC
README
PHP client for Mapbox Token API
The following feature of the Mapbox API are implemented:
- creation of a temporary token
Feel free to submit a PR or contact us if you need a missing feature.
The package uses Guzzle as an HTTP client.
Installation
This package can be install with composer
composer require assoconnect/mapbox-token
Usage
<?php
$guzzle = new GuzzleHttp\Client();
$client = new AssoConnect\MapboxToken\Client('YOUR MAPBOX USERNAME', 'YOUR MAPBOX TOKEN', $guzzle);
// Create a temporary token
$scopes = [
'styles:read',
'styles:tiles',
'fonts:read',
'datasets:read',
'uploads:write',
'uploads:read',
'tokens:write',
];
$expires = new \DateTime('+ 1 hour');
$client->createTemporaryToken($scopes, $expires)->token; // New temporary Mapbox token