Search by

pteal79 / geo-map

pteal79

A native map for NativePHP Mobile with coloured markers and shaded circles sized in metres (e.g. geofences). MapKit on iOS, MapLibre on Android, no API keys.

Package info

github.com/pteal79/geo-map

Type:nativephp-plugin

pkg:composer/pteal79/geo-map

Statistics

Installs: 2

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

1.0.0 2026-10-22 22:09 UTC

This package is auto-updated.

Last update: 2026-10-22 22:12:01 UTC


README

A native map for NativePHP Mobile with coloured markers and shaded circles sized in metres, for things like geofences. MapKit on iOS, MapLibre with OpenFreeMap tiles on Android. No API keys on either platform.

Installation

composer require pteal79/geo-map

Add the provider to your app's NativeServiceProvider::plugins():

use PTeal79\GeoMap\GeoMapServiceProvider;

public function plugins(): array
{
    return [
        // ...
        GeoMapServiceProvider::class,
    ];
}

Then rebuild the app (php artisan native:run).

Usage

<geo-map class="w-full h-72" :lat="$site->lat" :lng="$site->lng" :zoom="17" :follow="false">
    <geo-map-circle :lat="$site->lat" :lng="$site->lng" :radius="100"
                    fill-color="#F47920" :fill-opacity="0.2" :stroke-width="2" />
    <geo-map-marker :lat="$site->lat" :lng="$site->lng" title="Site" color="#F47920" />
    <geo-map-marker :lat="$me->lat" :lng="$me->lng" title="You" color="#16A34A" />
</geo-map>

The native: prefix works too (<native:geo-map>).

<geo-map>

Attribute Default Notes
lat, lng none Camera centre. Without them iOS frames the map's content and Android shows its default view.
zoom 15 Web-mercator zoom level.
follow true Re-centre whenever lat/lng change. With false the camera is positioned once and the user's own pan and zoom are kept.
interactive true Pan and pinch.
show-user-location false The platform's own location dot. Needs location permission (skipped without it).

The map is 280 points tall unless a height class is given.

<geo-map-circle>

Attribute Default Notes
lat, lng none Centre.
radius 100 Metres on the ground, so the circle scales with zoom.
fill-color #3B82F6 #RRGGBB.
fill-opacity 0.2 0 to 1.
stroke-color the fill colour #RRGGBB.
stroke-width 2 Points/dp; 0 for no outline.

<geo-map-marker>

Attribute Default Notes
lat, lng none Position.
title '' Label (shown under the dot on iOS).
color #EA4335 #RRGGBB.

Markers and circles are read by the map as data and redrawn only when they change, so binding a marker to a live location fix just moves the dot.

Platform notes

  • iOS 18.2+ (SwiftUI MapKit). Android API 26+ (MapLibre org.maplibre.gl:android-sdk:11.11.0).
  • Android needs INTERNET for map tiles, which the plugin declares.

Testing

composer test

License

MIT