PHPackages                             vpro/geocoding - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. vpro/geocoding

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

vpro/geocoding
==============

A PHP package to convert addresses to latitude and longitude coordinates using OpenStreetMap

12PHP

Since Oct 30Pushed 1y ago1 watchersCompare

[ Source](https://github.com/Victor070656/geocoder)[ Packagist](https://packagist.org/packages/vpro/geocoding)[ RSS](/packages/vpro-geocoding/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

PHP Geocoding Package
=====================

[](#php-geocoding-package)

A simple and efficient PHP package for converting addresses into latitude and longitude coordinates using OpenStreetMap's Nominatim service. No API key required!

Features
--------

[](#features)

- Convert addresses to latitude/longitude coordinates
- Batch geocoding support
- Reverse geocoding (coordinates to address)
- No API key required
- Rate limiting built-in
- Exception handling
- PSR-4 compliant
- Fully tested

Requirements
------------

[](#requirements)

- PHP 7.4 or higher
- Composer
- `ext-json` PHP extension
- GuzzleHttp 7.0 or higher

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

[](#installation)

Install the package via Composer:

```
composer require vpro/geocoding
```

Basic Usage
-----------

[](#basic-usage)

```
use Geocoding\Geocoder;

// Initialize the geocoder with your application name
$geocoder = new Geocoder('YourApp/1.0');

// Convert address to coordinates
try {
    $coordinates = $geocoder->geocode('1600 Amphitheatre Parkway, Mountain View, CA');
    if ($coordinates) {
        echo "Latitude: {$coordinates['lat']}\n";
        echo "Longitude: {$coordinates['lng']}\n";
    }
} catch (GeocodingException $e) {
    echo "Error: " . $e->getMessage();
}
```

Batch Geocoding
---------------

[](#batch-geocoding)

```
$addresses = [
    'Empire State Building, NY',
    'Golden Gate Bridge, SF'
];

$results = $geocoder->batchGeocode($addresses);
foreach ($results as $address => $coordinates) {
    if ($coordinates) {
        echo "$address:\n";
        echo "Latitude: {$coordinates['lat']}\n";
        echo "Longitude: {$coordinates['lng']}\n";
    }
}
```

Reverse Geocoding
-----------------

[](#reverse-geocoding)

```
$address = $geocoder->reverseGeocode(37.4224764, -122.0842499);
if ($address) {
    echo "Address: {$address['address']}\n";
    echo "Details: " . print_r($address['details'], true);
}
```

Important Notes
---------------

[](#important-notes)

1. **Usage Policy**: This package uses OpenStreetMap's Nominatim service. Please respect their usage policy:

    - Maximum of 1 request per second
    - Set a meaningful User-Agent header
    - For heavy usage, consider hosting your own Nominatim instance
2. **Error Handling**: All methods may throw `GeocodingException` on failure. Always wrap calls in try-catch blocks.

Testing
-------

[](#testing)

Run the test suite:

```
./vendor/bin/phpunit
```

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

[](#contributing)

1. Fork the repository
2. Create your feature branch (`git checkout -b feature/amazing-feature`)
3. Commit your changes (`git commit -m 'Add some amazing feature'`)
4. Push to the branch (`git push origin feature/amazing-feature`)
5. Open a Pull Request

License
-------

[](#license)

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.

###  Health Score

14

—

LowBetter than 2% of packages

Maintenance29

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity16

Early-stage or recently created project

 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/7aa81173a8e4882ea654a65c2dd74d83afbf5d58a74220a00f59b8ef42ca82ba?d=identicon)[vpro](/maintainers/vpro)

---

Top Contributors

[![Victor070656](https://avatars.githubusercontent.com/u/109238181?v=4)](https://github.com/Victor070656 "Victor070656 (1 commits)")

### Embed Badge

![Health badge](/badges/vpro-geocoding/health.svg)

```
[![Health](https://phpackages.com/badges/vpro-geocoding/health.svg)](https://phpackages.com/packages/vpro-geocoding)
```

###  Alternatives

[akiraz2/yii2-ticket-support

Yii2 Support Ticket Module, easy, flexible, fast

611.7k](/packages/akiraz2-yii2-ticket-support)

PHPackages © 2026

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