wladtitow / mapbox-php
PHP API mapbox library.
dev-master
2019-11-19 13:38 UTC
Requires
- php: >=5.6
- ext-curl: *
- ext-json: *
- guzzlehttp/guzzle: >=6.4
- nixsolutions/yandex-php-common: dev-mapbox
Requires (Dev)
- phpunit/phpunit: 6.5.5
- squizlabs/php_codesniffer: ^3.0
This package is auto-updated.
Last update: 2024-09-27 22:12:59 UTC
README
В разработке
Установка
Библиотека устанавливается с помощью пакетного менеджера Composer.
-
Добавьте библиотеку в файл
composer.json
вашего проекта:{ "repositories": [ { "type": "vcs", "url": "https://github.com/WladTitow/yandex-market-php-common" } ], "require": { "wladtitow/mapbox-php": "dev-master" } }
-
Включите автозагрузчик Composer в код проекта:
require __DIR__ . '/vendor/autoload.php';
Пример использования
use \Mapbox\Models\RequestPoint as Point; require __DIR__ . '/vendor/autoload.php'; $token = 'тут токен'; $navigationClient = new \Mapbox\Clients\Navigation\RetrieveMatrixClient('test', $token); $matrixRequest = new \Mapbox\Models\Request\RetrieveMatrixRequest(); $point1 = new Point(array('longitude' => -122.42, 'latitude' => 37.78)); $point2 = new Point(array('longitude' => -122.45, 'latitude' => 37.91)); $point3 = new Point(array('longitude' => -122.48, 'latitude' => 37.73)); $matrixRequest ->addRequestPoint($point1) ->addRequestPoint($point2) ->addRequestPoint($point3); $retrieveMatrix = $navigationClient->getRetrieveMatrix($matrixRequest); print_r($retrieveMatrix->getCode()); print_r($retrieveMatrix->getDurations()); print_r($retrieveMatrix->getDistances()); print_r($retrieveMatrix->getSources()); print_r($retrieveMatrix->getDestinations());