PHPackages                             dericcain/geo-things - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. dericcain/geo-things

ActiveLibrary

dericcain/geo-things
====================

Takes various inputs and geo-decodes/encodes, etc.

v1.0(9y ago)02.0kMITPHPPHP &gt;=5.5.0

Since Dec 25Pushed 9y agoCompare

[ Source](https://github.com/dericcain/geo-thing)[ Packagist](https://packagist.org/packages/dericcain/geo-things)[ RSS](/packages/dericcain-geo-things/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (1)Versions (6)Used By (0)

\#Geo Thing [![Build Status](https://camo.githubusercontent.com/db6a528d18cad2b1a1458acde8a9d5cfde9663de0d87415c61cca1fe641639b4/68747470733a2f2f7472617669732d63692e6f72672f64657269636361696e2f67656f2d7468696e672e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/dericcain/geo-thing)

Description
-----------

[](#description)

Ever need to quickly get the address from a set of coordinates? What about getting the coordinates from an address, or even the distance between 2 addresses? This is a very simple package that uses Google's API to perform those very operations. As a default, you do not have to supply an API key but you will be limited with how many API requests you can make. If you are not making a ton of calls, this should be good enough.

Installation
------------

[](#installation)

Use composer to install the package like so:

```
composer require dericcain/geo-things
```

Usage
-----

[](#usage)

It's fairly simple to use the package. You will need to import that package at the top of your PHP file. Once you have done that, you can use the different methods below.

#### Get Coordinates from Address

[](#get-coordinates-from-address)

```
// You will need to declare the namespace
use GeoThing/GeoThing;

$address = '123 Main Street';
$zip = '32119';

$results = GeoThing::getCoordinates($address, $zip);

$results->lat // 33.5075002
$results->lng // -86.8105789
$results->error // The error code from Google if there is one. This attribute will not be here if there is not error.
```

If there are no results, or there is an error, the object returned will have an `error` attribute giving the reason for the error. Also, the `lat` and `lng` attributes will be set to `null`.

#### Get Address from Coordinates

[](#get-address-from-coordinates)

```
// You will need to declare the namespace
use GeoThing/GeoThing;

$response = GeoThing::getAddress($lat, $lng);

$response->error // This will only be set if there is an error
$response->street_number // The number only
$response->street_name // The name of the street
$response->city // The full city name
$response->state // The full state name, not the abbreviation
$response->zip // The zip code
$response->formatted_address // The full formated address "277 Bedford Avenue, Brooklyn, NY 11211, USA"
```

#### Get Distance between Origin and Destination

[](#get-distance-between-origin-and-destination)

```
// You will need to declare the namespace
use GeoThing/GeoThing;

$response = GeoThing::getDistance($origin, $destination);

$response->error // This will only be set if there is an error
$response->distance // This will be a string like "1.2 mi" (I'll change this soon)
$response->duration // This will also be a string as of right now
```

#### Helper Functions

[](#helper-functions)

Once the package is installed using Composer, you will have access to some global helper functions. This is good if you want to call the different functions in a view, or somewhere else that is a little more difficult to declare `use` statements. Here are the helper functions:

```
getAddress($lat, $lng, $apiKey); // $apiKey is optional
getCoordinates($address, $zip, $apiKey); // $apiKey is optional
getDistance($origin, $destination, $apiKey); // $apiKey is optional
```

Contributing
------------

[](#contributing)

Please feel free to help with this small project. Let me know if you see a bug, or want to add something. If you do a pull request, make sure that you test your code and all of the tests are passing. This is required before the work will be merged.

Contact
-------

[](#contact)

Give me a shout!

-
- @dericcain

TODO
----

[](#todo)

- Get distance between two sets of coordinates
- Add KM to distance as an option

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity18

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~1 days

Total

4

Last Release

3427d ago

Major Versions

v0.9.2 → v1.02016-12-28

### Community

Maintainers

![](https://www.gravatar.com/avatar/84422a425f37c214e72a98eb61b878174f6ae48c4294c8fcc4399b2c2dfff203?d=identicon)[dericcain](/maintainers/dericcain)

---

Top Contributors

[![dericcain](https://avatars.githubusercontent.com/u/34040106?v=4)](https://github.com/dericcain "dericcain (11 commits)")

---

Tags

geolocationgeogeocodegeoencode

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/dericcain-geo-things/health.svg)

```
[![Health](https://phpackages.com/badges/dericcain-geo-things/health.svg)](https://phpackages.com/packages/dericcain-geo-things)
```

###  Alternatives

[menarasolutions/geographer

A PHP library that knows how any country, state or city is called in any language

765733.1k4](/packages/menarasolutions-geographer)[anthonymartin/geo-location

Powerful GeoCoding library: Retrieve bounding box coordinates, distances between geopoints, point in polygon, get longitude and latitude from addresses and more with GeoLocation for PHP

196949.5k5](/packages/anthonymartin-geo-location)[yandex/geo

PHP-library for interactions with geo-coding Yandex.Maps

117309.0k3](/packages/yandex-geo)[ipip/db

IPIP.net officially supported IP database ipdb format parsing library

139204.2k6](/packages/ipip-db)[maxh/php-nominatim

Wrapper for Nominatim API

51396.0k2](/packages/maxh-php-nominatim)[devrabiul/laravel-geo-genius

Laravel GeoGenius — A powerful, intelligent toolkit for geo-location, timezone, and locale-based features in Laravel applications.

1757.6k](/packages/devrabiul-laravel-geo-genius)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
