Laravel Geocoding

Laravel Geocoding

Geocod.io the geocoding service created by Mathias Hansen has just released a PHP and Laravel library for integrating with the service. It includes geocoding, reverse geocoding, and data matching for US and Canadian addresses.

Here is an example:

$response = Geocodio::geocode('1109 N Highland St, Arlington, VA');

/*
{
  "input": {
    "address_components": {
      "number": "1109"                                                       
      "predirectional": "N"                                                   
      "street": "Highland"                                                   
      "suffix": "St"                                                    
      "formatted_street": "N Highland St"                                     
      "city": "Arlington"                                                     
      "state": "VA"                                                           
      "country": "US"                                                         
    }                                                                        
    "formatted_address": "1109 N Highland St, Arlington, VA"                
  }             
  "results": array:2 [                                                         
    0 => {
      "address_components": {
        "number": "1109"                                                       
        "predirectional": "N"
        "street": "Highland"   
        "suffix": "St"
        "formatted_street": "N Highland St"
        "city": "Arlington"
        "county": "Arlington County"
        "state": "VA"
        "zip": "22201"
        "country": "US"
      }
      "formatted_address": "1109 N Highland St, Arlington, VA 22201"
      "location": {
        "lat": 38.886672
        "lng": -77.094735
      }
      "accuracy": 1
      "accuracy_type": "rooftop"
      "source": "Arlington"
    }
    1 => {
      "address_components": {
        "number": "1109"
        "predirectional": "N"
        "street": "Highland"
        "suffix": "St"
        "formatted_street": "N Highland St"
        "city": "Arlington"
        "county": "Arlington County"
        "state": "VA"
        "zip": "22201"
        "country": "US"
      }
      "formatted_address": "1109 N Highland St, Arlington, VA 22201"
      "location": {
        "lat": 38.886665
        "lng": -77.094733
      }
      "accuracy": 1
      "accuracy_type": "rooftop"
      "source": "Virginia Geographic Information Network (VGIN)"
    }
  ]
}
*/

Of course, this is just the basics and geocoding can be useful for a myriad of things while we are building applications. This could be everything from finding latitude/longitude, addresses, proper zip codes, timezones, or even Congressional information.

You can find out more details and try out the package from their Github repo and the first 2,500 lookups per day are free.


Filed in: News / packages


Newsletter

Join the weekly newsletter and never miss out on new tips, tutorials, and more.

Laravel News Partners

Laravel Jobs

Senior Laravel Developer (Full-Stack)
Munich
Volunteer Vision GmbH
Full-Stack Developer
Tampa
Nu Image Medical
Senior Software Developer
Remote (US ONLY)/Kenilworth, NJ
Diversified
Senior Back-end Laravel API Developer - Immediate Contract (Full Time)
Remote
ApproveMe // Document Signing
Web Development Project Manager
Houston, TX
Swyft Filings
Experienced Laravel/VueJS Developer (Freelance)
Remote (preferably in the US)
Prosperly LLC
Senior React / Laravel Developer
Remote
The C.A.S.E. Engineering Group