guppylab

Routing — $49, one-time

How far, and how long, to each of these.

One origin, many destinations, one call. Real road distance and travel time — the numbers you need to order a list of stores, pickup points or drivers by how long it actually takes to get there, not by a straight line on a map.

NativePHP has plugins that draw a map. This is the one that answers how far and how long.

Real road ETAs — $49One-time payment. Your Composer key arrives by email.
Recorded on an iPhone XR · MapKit, São Paulo
Read this before buying: Android needs a routing endpoint.

iOS routes on the device through MapKit, free and with no key. Android has no on-device routing engine at all — Play Services Location only positions, the Maps SDK only draws, and the google.navigation: intent hands the user to the Maps app without returning anything.

So on Android the plugin talks to a routing service, and the plugin ships the adapter for five of them. The account is yours: billed to you, under that provider's terms, and any attribution they require is yours to display. We carry no quota and no key. Without a provider configured, Android falls back cleanly and tells your app so.

Providers on Android

MapboxMatrix API. The free tier is metered in elements — origins × destinations.
openrouteserviceResults are licensed CC-BY-SA and attribution is required. Check both against your use before choosing it.
GeoapifyCommercial use allowed on the free tier, with visible attribution.
GoogleRoutes computeRouteMatrix. Billed per element.
OSRMYour own osrm-backend, or any endpoint speaking its table/route shape — including your own API proxying one of the above.

Switching provider is one line of config. Each one speaks a different dialect — Geoapify indexes by target_index, Google returns an array with the duration as a string — and the adapters translate, so your app sees one shape.

A key in the app config ships inside the build, where anyone holding the APK can read it. For production, point the OSRM adapter at your own backend instead: the key stays on your server, results can be cached per area, and you can swap provider without shipping a new version.

What it does

How it works

Install

composer require guppylab/routing. The key from your purchase email unlocks the private repository; bought on the NativePHP marketplace, your NativePHP credentials do.

Ask once

Directions::distances() with one origin and many destinations. On iPhone, MapKit answers on the device; on Android, the provider you configured.

Use the answer

DistancesReceived brings meters and seconds per destination. Sort the list, show the ETA, then navigate() hands the pick to Maps or Waze.

Where it fits

How it looks

use Guppylab\Directions\Facades\Directions;
use Guppylab\Directions\Events\DistancesReceived;
use Native\Mobile\Attributes\OnNative;

Directions::distances($lat, $lng, [
    ['id' => 1, 'lat' => -23.5614, 'lng' => -46.6559],
    ['id' => 2, 'lat' => -23.5880, 'lng' => -46.6820],
]);

#[OnNative(DistancesReceived::class)]
public function onDistances(string $results = '[]', ?string $id = null): void
{
    $event = new DistancesReceived($results, $id);

    if ($event->failed()) {
        $this->useStraightLineEstimate();

        return;
    }

    $this->etas = $event->routed();   // ['1' => ['meters' => 4312, 'seconds' => 780, …]]
}

Locations stay between you and the map

Platforms

iOSMapKit MKDirections, iOS 15+. On-device, no key, no quota, nothing to configure.
AndroidAPI 21+, plus an account with one of the providers above. Requires INTERNET, which the plugin declares.
NativePHP Mobile3.x and 4.x

Licence and delivery

Real road ETAs — $4914-day refund, no questions asked.

Already on NativePHP Ultra? Routing is also on the NativePHP Plugin Marketplace: $49, or $35 for Ultra subscribers.

Not sure it fits? Ask first: suporte@guppylab.com.br