A PHP library for geographical calculations including distance, geofencing, and coordinate formatting with support for multiple ellipsoids.
phpgeo is a PHP library for handling geographical data and performing spatial calculations. It provides abstractions for coordinates, lines, polygons, and other geometric shapes, enabling developers to calculate distances, perform geofencing, and format geographic data in various formats. The library solves the problem of integrating precise geographic computations into PHP applications without relying on external services.
PHP developers building applications that require geographic calculations, such as mapping tools, location-based services, logistics software, or any system dealing with spatial data.
Developers choose phpgeo for its high-precision calculations, support for multiple ellipsoids and algorithms, and comprehensive feature set including geofencing and coordinate formatting—all within a lightweight, PHP-native library.
Simple Yet Powerful Geo Library for PHP
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Supports Vincenty and Haversine formulas for accurate distance calculations, demonstrated in the README with examples returning meter-level precision.
Provides abstractions for coordinates, lines, polygons, and polylines with operations like geofencing and simplification using the Ramer–Douglas–Peucker algorithm.
Allows coordinates to be formatted as Decimal Degrees, DMS, or GeoJSON, with customizable formatters shown in the documentation examples.
Regularly updated with support for PHP up to version 8.5 and a clear version compatibility matrix, ensuring long-term viability and security updates.
The README explicitly warns that polygon containment calculations give wrong results for shapes crossing the 180/-180 meridian, limiting global applications.
Active versions require PHP 8.2 or higher, which can force upgrades in legacy projects or exclude teams on older PHP stacks.
Purely a computational library with no built-in mapping or graphical output, necessitating additional tools for any visual representation of geographic data.