PHP code example of mrden / mkad-distance

1. Go to this page and download the library: Download mrden/mkad-distance 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/ */

    

mrden / mkad-distance example snippets


use Mrden\MkadDistance\Distance;
// Расчет по массиву координат
$distance = Distance::calculateByRouteToMoscowMkad(
    [55.860297, 37.120094]
);

// Расчет по экземпляру класса \Mrden\MkadDistance\Geometry\Point
$distance = Distance::calculateByRouteToMoscowMkad(
    new \Mrden\MkadDistance\Geometry\Point(55.860297, 37.120094)
);

// Расчет по текстовому названию
$distance = Distance::calculateByRouteToSpbKad(
    'Санкт-Петербург, посёлок Песочный, Советская улица, 34/21',
    ['yandexGeoCoderApiKey' => 'YOUR_TOKEN']   
);

// Cache
$cache = new AnySimpleCacheInterfaceRealisation();
$distance = Distance::calculateByRouteToMoscowMkad(
    new \Mrden\MkadDistance\Geometry\Point(55.860297, 37.120094),
    ['cache' => $cache]
);