1. Go to this page and download the library: Download cyrildewit/php-maps-urls 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/ */
cyrildewit / php-maps-urls example snippets
use CyrildeWit\MapsUrls\UrlGenerator;
use CyrildeWit\MapsUrls\Actions\SearchAction;
use CyrildeWit\MapsUrls\Actions\DirectionsAction;
$searchAction = (new SearchAction())
->setQuery('The Netherlands Amsterdam');
$searchUrl = (new UrlGenerator($searchAction))->generate();
$directionsAction = (new DirectionsAction())
->setOrigin('The Netherlands Amsterdam')
->setDestination('The Netherlands Utrecht');
$directionsUrl = (new UrlGenerator($directionsAction))->generate();
use CyrildeWit\MapsUrls\UrlGenerator;
use CyrildeWit\MapsUrls\Actions\SearchAction;
$searchAction = (new SearchAction())
->setQuery('Eindhoven, Nederland');
$searchUrl = (new UrlGenerator($searchAction))->generate();
use CyrildeWit\MapsUrls\Actions\SearchAction;
$searchAction = (new SearchAction())
->setQuery('Eindhoven, Nederland');
use CyrildeWit\MapsUrls\Actions\SearchAction;
$searchAction = (new SearchAction())
->setQueryCoordinates(47.5951518, -122.3316393);
use CyrildeWit\MapsUrls\Actions\SearchAction;
$searchAction = (new SearchAction())
->setQueryPlaceId('ChIJn8N5VRvZxkcRmLlkgWTSmvM');
use CyrildeWit\MapsUrls\Actions\DirectionsAction;
$directionsAction = (new DirectionsAction())
->setOrigin('Eindhoven, Nederland');
use CyrildeWit\MapsUrls\Actions\DirectionsAction;
$directionsAction = (new DirectionsAction())
->setOrigin('Eindhoven, Nederland')
->setOriginPlaceId('ChIJn8N5VRvZxkcRmLlkgWTSmvM');
use CyrildeWit\MapsUrls\Actions\DirectionsAction;
$directionsAction = (new DirectionsAction())
->setDestination('Monnickendam, Nederland');
use CyrildeWit\MapsUrls\Actions\DirectionsAction;
$directionsAction = (new DirectionsAction())
->setDestination('Monnickendam, Nederland')
->setDestinationPlaceId('ChIJTZfQeLgFxkcRQhAYGf9HbrU');
use CyrildeWit\MapsUrls\Actions\DirectionsAction;
use CyrildeWit\MapsUrls\Enums\TravelMode;
$directionsAction = (new DirectionsAction())
->setTravelmode(TravelMode::BICYCLING);
use CyrildeWit\MapsUrls\Actions\DirectionsAction;
use CyrildeWit\MapsUrls\Enums\DirectionAction;
$directionsAction = (new DirectionsAction())
->setDirectionAction(DirectionAction::NAVIGATE);
use CyrildeWit\MapsUrls\Actions\DirectionsAction;
$directionsAction = (new DirectionsAction())
->setWaypoints([
'Berlin,Germany',
'Paris,France'
]);
use CyrildeWit\MapsUrls\Actions\DirectionsAction;
$directionsAction = (new DirectionsAction())
->setWaypoints([
'Berlin,Germany',
'Paris,France'
])
->setWaypointPlaceIds([
'ChIJAVkDPzdOqEcRcDteW0YgIQQ',
'ChIJD7fiBh9u5kcRYJSMaMOCCwQ'
]);
use CyrildeWit\MapsUrls\Actions\DisplayMapAction;
use CyrildeWit\MapsUrls\Enums\BaseMap;
$displayMapAction = (new DisplayMapAction())
->setBaseMap(BaseMap::TRAFFIC);
use CyrildeWit\MapsUrls\Actions\DisplayMapAction;
use CyrildeWit\MapsUrls\Enums\Layer;
$displayMapAction = (new DisplayMapAction())
->setLayer(Layer::TRAFFIC);
use CyrildeWit\MapsUrls\Actions\DirectionsAction;
use CyrildeWit\MapsUrls\Enums\BaseMap;
use CyrildeWit\MapsUrls\Enums\Layer;
$displayMapAction = DirectionsAction::make([
'center' => [-33.8569, 151.2152],
'zoom' => 10,
'basemap' => BaseMap::BICYCLING,
'layer' => Layer::TRANSIT,
]);
use CyrildeWit\MapsUrls\Actions\DisplayStreetViewPanoramaAction;
$displayStreetViewPanoramaAction = (new DisplayStreetViewPanoramaAction())
->setViewpoint(48.857832, 2.295226);
use CyrildeWit\MapsUrls\Actions\DisplayStreetViewPanoramaAction;
$displayStreetViewPanoramaAction = (new DisplayStreetViewPanoramaAction())
->setPanoramaId('tu510ie_z4ptBZYo2BGEJg');
use CyrildeWit\MapsUrls\Actions\DisplayStreetViewPanoramaAction;
$displayStreetViewPanoramaAction = (new DisplayStreetViewPanoramaAction())
->setHeading(120);
use CyrildeWit\MapsUrls\Actions\DisplayStreetViewPanoramaAction;
$displayStreetViewPanoramaAction = (new DisplayStreetViewPanoramaAction())
->setPitch(40);
use CyrildeWit\MapsUrls\Actions\DisplayStreetViewPanoramaAction;
$displayStreetViewPanoramaAction = (new DisplayStreetViewPanoramaAction())
->setFov(80);