snezhkoigor/map is a Laravel package for a development package for all map providers.
It currently has 1 GitHub stars and 214 downloads on Packagist (latest version v1.9.0).
Install it with composer require snezhkoigor/map.
Discover more Laravel packages by snezhkoigor
or browse all Laravel packages to compare alternatives.
Last updated
composer require snezhkoigor/map
providers array key in config/app.php and register
the Map Service Provider:// 'providers' => [
Map\Laravel\MapServiceProvider::class,
// ];
By default, the configuration specifies a Chain provider, containing the GoogleMaps provider for addresses as well as reverse lookups with lat/long.
However, you are free to add or remove providers as needed, both inside the Chain provider, as well as along-side it. The following is the default configuration provided by the package:
<?php
use Map\Laravel\Providers\Yandex;
return [
/*
|--------------------------------------------------------------------------
| Providers
|--------------------------------------------------------------------------
|
*/
'providers' => [
Yandex::class => [
'key' => env('YANDEX_ROUTE_KEY', ''),
'proxy' => env('YANDEX_PROXY_IP', null)
]
]
];
If you would like to make changes to the default configuration, publish and edit the configuration file:
php artisan vendor:publish --provider="Map\Laravel\MapServiceProvider" --tag="config"
The service provider initializes the map service, accessible via the
facade Map::... or the application helper app('map')->....
$way = app('map')->route(
(new RouteQuery())
->withThroughPoint(new Coordinate(56.991837, 60.477136))
->withThroughPoint(new Coordinate(56.907375, 60.780160))
->withThroughPoint(new Coordinate(58.201698, 68.253762))
);
Result would be Collection of Coordinate class:
{
'provided_by': ...,
'way_points': [
{
latitude:
longitude:
},
{
latitude:
longitude:
},
...
{
latitude:
longitude:
}
]
}
Package provides dumpers that aim to transform a some object in standard formats.
$way = app('map')->route(
(new RouteQuery())
->withThroughPoint(new Coordinate(56.991837, 60.477136))
->withThroughPoint(new Coordinate(56.907375, 60.780160))
->withThroughPoint(new Coordinate(58.201698, 68.253762))
->withAvoidTollsRoads()
);
$kml = (new Kml())->dumpRoute('name', $way)