9 Best PHP Geolocation Libraries

share link

by Dhiren Gala dot icon Updated: Jul 31, 2023

technology logo
technology logo

Guide Kit Guide Kit  

You can use these tools to determine the location of website visitors based on their IP address or other location data.


These libraries provide a range of functionalities such as geocoding, reverse geocoding, distance calculations, and mapping. They allow developers to determine website visitors' country, city, region, and latitude/longitude based on their IP address. Google Maps Geolocation API is one of the most widely used PHP geolocation libraries. It provides a simple and reliable way to determine the location of website visitors using data from Google Maps. It allows developers to get the latitude and longitude of a location and its estimated accuracy. These libraries enable developers to provide a more personalized user experience by showing relevant content based on the location of website visitors. They also help you to create custom maps and visualizations based on geospatial data and enable location-based advertising and marketing strategies.


PHP Geolocation Libraries are essential tools for web developers who want to create location-based web applications. We have handpicked the top and trending open-source PHP routing libraries for your next application development project:

GeoIP2 PHP:

  • Used in Web Services, REST applications, etc.
  • Provides an easy-to-use API for working with MaxMind's GeoIP2 and GeoLite2 databases.
  • Allows developers to determine the location of website visitors based on their IP address.

GeoIP2-phpby maxmind

PHP doticonstar image 2183 doticonVersion:v2.13.0doticon
License: Permissive (Apache-2.0)

PHP API for GeoIP2 webservice client and database reader

Support
    Quality
      Security
        License
          Reuse

            GeoIP2-phpby maxmind

            PHP doticon star image 2183 doticonVersion:v2.13.0doticon License: Permissive (Apache-2.0)

            PHP API for GeoIP2 webservice client and database reader
            Support
              Quality
                Security
                  License
                    Reuse

                      Google Maps Geolocation API:

                      • Used to determine the location of website visitors using data from Google Maps.
                      • Allows developers to get the latitude and longitude of a location.
                      • Also provides the estimated accuracy of the location.

                      google-mapsby alexpechkarev

                      PHP doticonstar image 470 doticonVersion:v10.0.1doticon
                      License: Permissive (MIT)

                      Collection of Google Maps API Web Services for Laravel

                      Support
                        Quality
                          Security
                            License
                              Reuse

                                google-mapsby alexpechkarev

                                PHP doticon star image 470 doticonVersion:v10.0.1doticon License: Permissive (MIT)

                                Collection of Google Maps API Web Services for Laravel
                                Support
                                  Quality
                                    Security
                                      License
                                        Reuse

                                          Leaflet:

                                          • Used to handle dynamic map configurations working in a PHP context.
                                          • It is lightweight and easy to use for building mobile-friendly interactive maps.
                                          • Supports a wide range of map providers.

                                          php-leafletby netzmacht

                                          PHP doticonstar image 14 doticonVersion:Currentdoticon
                                          License: Weak Copyleft (LGPL-3.0)

                                          PHP Leaflet maps definition library.

                                          Support
                                            Quality
                                              Security
                                                License
                                                  Reuse

                                                    php-leafletby netzmacht

                                                    PHP doticon star image 14 doticonVersion:Currentdoticon License: Weak Copyleft (LGPL-3.0)

                                                    PHP Leaflet maps definition library.
                                                    Support
                                                      Quality
                                                        Security
                                                          License
                                                            Reuse

                                                              GeoPHP:

                                                              • Used in Geo, Map applications, etc.
                                                              • It’s a native PHP library for geometry operations and provides basic geospatial functionality.
                                                              • Features include point-in-polygon testing, distance calculations, and geometry simplification.

                                                              geoPHPby phayes

                                                              PHP doticonstar image 815 doticonVersion:Currentdoticon
                                                              License: Others (Non-SPDX)

                                                              Advanced geometry operations in PHP

                                                              Support
                                                                Quality
                                                                  Security
                                                                    License
                                                                      Reuse

                                                                        geoPHPby phayes

                                                                        PHP doticon star image 815 doticonVersion:Currentdoticon License: Others (Non-SPDX)

                                                                        Advanced geometry operations in PHP
                                                                        Support
                                                                          Quality
                                                                            Security
                                                                              License
                                                                                Reuse

                                                                                  Geocoder:

                                                                                  • Used in Utilities, Command Line Interface, Laravel applications, etc.
                                                                                  • Provides geocoding and reverse geocoding services.
                                                                                  • Supports data from various providers such as Google Maps, OpenStreetMap, and Bing Maps.

                                                                                  Geocoderby geocoder-php

                                                                                  PHP doticonstar image 3900 doticonVersion:4.3.0doticon
                                                                                  License: Permissive (MIT)

                                                                                  The most featured Geocoder library written in PHP.

                                                                                  Support
                                                                                    Quality
                                                                                      Security
                                                                                        License
                                                                                          Reuse

                                                                                            Geocoderby geocoder-php

                                                                                            PHP doticon star image 3900 doticonVersion:4.3.0doticon License: Permissive (MIT)

                                                                                            The most featured Geocoder library written in PHP.
                                                                                            Support
                                                                                              Quality
                                                                                                Security
                                                                                                  License
                                                                                                    Reuse

                                                                                                      IP2Location:

                                                                                                      • Used in Networking, TCP applications, etc.
                                                                                                      • Provides fast lookup and geolocation services based on IP address data.
                                                                                                      • Includes a database of IP address ranges and location data for various countries and regions.

                                                                                                      IP2Location-PHP-Moduleby chrislim2888

                                                                                                      PHP doticonstar image 176 doticonVersion:9.7.0doticon
                                                                                                      License: Permissive (MIT)

                                                                                                      This module is a PHP module that enables the user to find the country, region, city, coordinates, zip code, ISP, domain name, timezone, connection speed, IDD code, area code, weather station code, weather station name, mobile, usage types, address type, IAB category, etc that any IP address or host name originates from.

                                                                                                      Support
                                                                                                        Quality
                                                                                                          Security
                                                                                                            License
                                                                                                              Reuse

                                                                                                                IP2Location-PHP-Moduleby chrislim2888

                                                                                                                PHP doticon star image 176 doticonVersion:9.7.0doticon License: Permissive (MIT)

                                                                                                                This module is a PHP module that enables the user to find the country, region, city, coordinates, zip code, ISP, domain name, timezone, connection speed, IDD code, area code, weather station code, weather station name, mobile, usage types, address type, IAB category, etc that any IP address or host name originates from.
                                                                                                                Support
                                                                                                                  Quality
                                                                                                                    Security
                                                                                                                      License
                                                                                                                        Reuse

                                                                                                                          SmartyStreets:

                                                                                                                          • Used in Web Services, REST applications, etc.
                                                                                                                          • Provides address validation and geocoding services.
                                                                                                                          • Uses data from various providers such as Google Maps, OpenStreetMap, and Bing Maps.

                                                                                                                          smartystreets-php-sdkby smartystreets

                                                                                                                          PHP doticonstar image 24 doticonVersion:Currentdoticon
                                                                                                                          License: Permissive (Apache-2.0)

                                                                                                                          The official client libraries for accessing SmartyStreets APIs from the PHP Hypertext Processor.

                                                                                                                          Support
                                                                                                                            Quality
                                                                                                                              Security
                                                                                                                                License
                                                                                                                                  Reuse

                                                                                                                                    smartystreets-php-sdkby smartystreets

                                                                                                                                    PHP doticon star image 24 doticonVersion:Currentdoticon License: Permissive (Apache-2.0)

                                                                                                                                    The official client libraries for accessing SmartyStreets APIs from the PHP Hypertext Processor.
                                                                                                                                    Support
                                                                                                                                      Quality
                                                                                                                                        Security
                                                                                                                                          License
                                                                                                                                            Reuse

                                                                                                                                              Geotools:

                                                                                                                                              • Used in Manufacturing, Utilities, Aerospace, Defense, Geo, Map applications, etc.
                                                                                                                                              • Supports accept almost kinds of WGS84 geographic coordinates.
                                                                                                                                              • Built on top Geocoder and React libraries.

                                                                                                                                              geotoolsby thephpleague

                                                                                                                                              PHP doticonstar image 1318 doticonVersion:1.1.0doticon
                                                                                                                                              License: Permissive (MIT)

                                                                                                                                              Geo-related tools PHP 7.3+ library built atop Geocoder and React libraries

                                                                                                                                              Support
                                                                                                                                                Quality
                                                                                                                                                  Security
                                                                                                                                                    License
                                                                                                                                                      Reuse

                                                                                                                                                        geotoolsby thephpleague

                                                                                                                                                        PHP doticon star image 1318 doticonVersion:1.1.0doticon License: Permissive (MIT)

                                                                                                                                                        Geo-related tools PHP 7.3+ library built atop Geocoder and React libraries
                                                                                                                                                        Support
                                                                                                                                                          Quality
                                                                                                                                                            Security
                                                                                                                                                              License
                                                                                                                                                                Reuse

                                                                                                                                                                  Location:

                                                                                                                                                                  • Used in Networking, TCP applications, etc.
                                                                                                                                                                  • Helps retrieve a user's location from their IP address using various services.
                                                                                                                                                                  • Works with PHP >= 7.3 and Laravel >= 5.0.

                                                                                                                                                                  locationby stevebauman

                                                                                                                                                                  PHP doticonstar image 853 doticonVersion:v6.6.2doticon
                                                                                                                                                                  License: Permissive (MIT)

                                                                                                                                                                  Detect a users location by their IP Address.

                                                                                                                                                                  Support
                                                                                                                                                                    Quality
                                                                                                                                                                      Security
                                                                                                                                                                        License
                                                                                                                                                                          Reuse

                                                                                                                                                                            locationby stevebauman

                                                                                                                                                                            PHP doticon star image 853 doticonVersion:v6.6.2doticon License: Permissive (MIT)

                                                                                                                                                                            Detect a users location by their IP Address.
                                                                                                                                                                            Support
                                                                                                                                                                              Quality
                                                                                                                                                                                Security
                                                                                                                                                                                  License
                                                                                                                                                                                    Reuse

                                                                                                                                                                                      See similar Kits and Libraries