A service wrapper around the City Mapper API

v1.1 2020-01-16 16:33 UTC

This package is auto-updated.

Last update: 2022-01-16 21:27:04 UTC


Latest Version on Packagist Software License Build Status Coverage Status Quality Score Total Downloads

A service wrapper around City Mapper


Via Composer

$ composer require juststeveking/laravel-city-mapper

After installation, merge configuration for services uusing:

$ php artisan vendor:publish --provider="JustSteveKing\LaravelCityMapper\CityMapperServiceProvider"

If, for some reason, this doesn't work please use the following steps:

  • Add the following into the config/services.php configuration file:

'citymapper' => [
    'key' => env('CITY_MAPPER_KEY', '')
  • Add CITY_MAPPER_KEY to your .env file and add your API key which you can get from here.

Basic Usage

If you want to interact with the service itself


class SomeController extends Controller
    protected $cityMapper;

    public function __construct(CityMapperService $service)
        $this->cityMapper = $service;

    public function index(Request $request)
        // get the travel time between two points
        $startCoordinates = [
            51.525246, // latitude
            0.084672 // longitude
        $endCoordinates = [
            51.559098, // latitude
            0.074503 // longitude
        $travelTime = $this->cityMapper->getTransitTime(

This will return the following stdClass object:

  +"travel_time_minutes": 43

Change log

Please see CHANGELOG for more information on what has changed recently.


$ composer test


Please see CONTRIBUTING and CODE_OF_CONDUCT for details.


If you discover any security related issues, please email juststevemcd@gmail.com instead of using the issue tracker.



The MIT License (MIT). Please see License File for more information.