PHPackages                             eegusakov/geo-search - 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. [Search &amp; Filtering](/categories/search)
4. /
5. eegusakov/geo-search

ActiveLibrary[Search &amp; Filtering](/categories/search)

eegusakov/geo-search
====================

A PHP library for finding location information, including geographic points, name, region, country, and time zone information.

v2.0.0(1y ago)711MITPHPPHP ^8.2

Since Jul 16Pushed 1y ago1 watchersCompare

[ Source](https://github.com/eegusakov/geo-search)[ Packagist](https://packagist.org/packages/eegusakov/geo-search)[ RSS](/packages/eegusakov-geo-search/feed)WikiDiscussions main Synced today

READMEChangelog (5)Dependencies (8)Versions (6)Used By (0)

Geo Search
==========

[](#geo-search)

[![GitHub](https://camo.githubusercontent.com/93b657e29c0e671b07c1fcd37016be9e6201df580394b791d69a0897b3b9ef3e/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f6565677573616b6f762f67656f2d736561726368)](https://camo.githubusercontent.com/93b657e29c0e671b07c1fcd37016be9e6201df580394b791d69a0897b3b9ef3e/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f6565677573616b6f762f67656f2d736561726368)[![GitHub code size in bytes](https://camo.githubusercontent.com/d5d3aaca18edbbdf9e2935fa6ab34dca0ad7113f72c7dbfd0cd7218da493e837/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c616e6775616765732f636f64652d73697a652f6565677573616b6f762f67656f2d736561726368)](https://camo.githubusercontent.com/d5d3aaca18edbbdf9e2935fa6ab34dca0ad7113f72c7dbfd0cd7218da493e837/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c616e6775616765732f636f64652d73697a652f6565677573616b6f762f67656f2d736561726368)[![CI](https://github.com/eegusakov/geo-search/actions/workflows/ci.yml/badge.svg)](https://github.com/eegusakov/geo-search/actions/workflows/ci.yml)[![PHP Version Requirement](https://camo.githubusercontent.com/c425b97fff55595662bf541b87afe6e1919f8528d6f1a2fc5c014cb0f978aae9/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646570656e64656e63792d762f6565677573616b6f762f67656f2d7365617263682f706870)](https://packagist.org/packages/eegusakov/geo-search)

Language: ENG, [RUS](docs/ru/README.md)

**Geo Search** - PHP library that will allow you to determine the geographical location of an object based on the transmitted data.

Third-party service APIs are used for the search, so the input data for the search may differ depending on the service. The entire list of available services is listed below.

Compatible with PSR
-------------------

[](#compatible-with-psr)

Any client compatible with PSR-18 is suitable for providing http requests. The examples will use the library [Guzzle](https://github.com/guzzle/guzzle)

Any client compatible with PSP-16 is suitable for working with the cache. The examples will use libraries [SymfonyCache](https://github.com/symfony/cache)

Any client compatible with PSR-3 is suitable for error logging ([Monolog](https://github.com/Seldaek/monolog) and so on.). The examples will use the ConsoleLogger included in the current library.

Getting started
---------------

[](#getting-started)

### Installing Geo Search

[](#installing-geo-search)

The recommended way to install Geo Search is via [Composer](http://getcomposer.org/).

```
composer require eegusakov/geo-search
```

### Services

[](#services)

Attention, to work with each service, you need to get an API access token. To get it, follow the link attached to a specific service

#### 1. WeatherApi

[](#1-weatherapi)

Link to the service:

Link to documentation:

Performs a search on the following data:

1. US postal code,
2. UK postal code,
3. postal code of Canada,
4. IP address,
5. latitude/longitude (decimal degree),
6. name of the city;

Example:

```
use GuzzleHttp\Client;
use GeoSearch\Engines\WeatherApi\WeatherApiSearchEngine;
use GeoSearch\Engines\WeatherApi\ResponseFromGeoDtoMapper;

$weatherApiSearchEngine = new WeatherApiSearchEngine(
    '',
    new Client()
);

$geoByCity = $weatherApiSearchEngine->search('Moscow');

$geoByCoordinates = $weatherApiSearchEngine->search('53,-0.12');

$geoByZipCode = $weatherApiSearchEngine->search('90201');
```

#### 2. OpenMeteo

[](#2-openmeteo)

Link to the service:

Link to documentation:

Performs a search on the following data:

1. name of the city,
2. postal code;

Example:

```
use GuzzleHttp\Client;
use GeoSearch\Engines\OpenMeteo\OpenMeteoSearchEngine;

$openMeteoSearchEngine = new OpenMeteoSearchEngine(
  new Client()
);

$geoByCity = $openMeteoSearchEngine->search('Moscow');

$geoByZipCode = $openMeteoSearchEngine->search('10001');
```

### Additional features

[](#additional-features)

**1. Using multiple services at once**

This library allows you to use several services at once and get the result of the first service that returned a non-empty response.

```
use GeoSearch\Engines\ChainSearchEngine;
use GeoSearch\Engines\OpenMeteo\OpenMeteoSearchEngine;
use GeoSearch\Engines\WeatherApi\WeatherApiSearchEngine;
use GuzzleHttp\Client;

$chainSearchEngine = new ChainSearchEngine(
    new WeatherApiSearchEngine(
        '',
        new Client()
    ),
    new WeatherApiSearchEngine(
        '',
        new Client()
    ),
    new OpenMeteoSearchEngine(
        new Client(),
    )
);

$geo = $chainSearchEngine->search('Moscow');
```

**2. The ability to ignore errors**

The functionality is relevant when there is a need to ignore errors and move on to the next request.

ErrorHandler processes all errors and writes them to the log, the library includes a basic logger that simply outputs information to the console (ConsoleLogger).

Any client compatible with PSR-3 is suitable for logging.

```
use GuzzleHttp\Client;
use GeoSearch\Engines\MuteSearchEngine;
use GeoSearch\Handlers\ErrorHandler;
use GeoSearch\Loggers\ConsoleLogger;
use GeoSearch\Engines\WeatherApi\WeatherApiSearchEngine;

$muteSearchEngine = new MuteSearchEngine(
    new WeatherApiSearchEngine(
        '',
        new Client()
    ),
    new ErrorHandler(
        new ConsoleLogger()
    )
);

$geo = $muteSearchEngine->search('Moscow');
```

**3. Ability to cache the response result**

Any client compatible with PSP-16 is suitable for working with the cache. The example will use [SymfonyCache](https://symfony.com/doc/current/components/cache.html).

```
use GeoSearch\Engines\WeatherApi\WeatherApiSearchEngine;
use Symfony\Component\Cache\Adapter\FilesystemAdapter;
use GeoSearch\Engines\CacheSearchEngine;
use Symfony\Component\Cache\Psr16Cache;
use GuzzleHttp\Client;

$cacheSearchEngine = new CacheSearchEngine(
    new WeatherApiSearchEngine(
        '',
        new Client()
    ),
    new Psr16Cache(
        new FilesystemAdapter()
    ),
    60
);

$geo = $cacheSearchEngine->search('Moscow');
```

**4. The ability to combine the 1st, 2nd and 3rd item**

```
use GuzzleHttp\Client;
use Symfony\Component\Cache\Psr16Cache;
use GeoSearch\Handlers\ErrorHandler;
use GeoSearch\Loggers\ConsoleLogger;
use GeoSearch\Engines\MuteSearchEngine;
use GeoSearch\Engines\CacheSearchEngine;
use GeoSearch\Engines\ChainSearchEngine;
use Symfony\Component\Cache\Adapter\FilesystemAdapter;
use GeoSearch\Engines\OpenMeteo\OpenMeteoSearchEngine;
use GeoSearch\Engines\WeatherApi\WeatherApiSearchEngine;

$cacheChainMuteSearchEngine = new CacheSearchEngine(
    new ChainSearchEngine(
        new MuteSearchEngine(
            new WeatherApiSearchEngine(
                'API_TOKEN_1',
                new Client()
            ),
            new ErrorHandler(
                new ConsoleLogger()
            )
        ),
        new MuteSearchEngine(
            new OpenMeteoSearchEngine(
                new Client()
            ),
            new ErrorHandler(
                new ConsoleLogger()
            )
        )
    ),
    new Psr16Cache(
        new FilesystemAdapter()
    ),
    60
);

$geo = $cacheChainMuteSearchEngine->search('Moscow');
```

Cooperation
-----------

[](#cooperation)

Please read [CONTRIBUTING](CONTRIBUTING.md) for more information about our code of conduct and the process of sending us merge requests.

License
-------

[](#license)

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

###  Health Score

32

—

LowBetter than 69% of packages

Maintenance38

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity60

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 ~136 days

Total

5

Last Release

538d ago

Major Versions

v1.0.3 → v2.0.02025-01-10

PHP version history (2 changes)v1.0.0PHP ^8.0

v2.0.0PHP ^8.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/105296445ff3d46315e70c06c175e03e03d881d6cf84b405bc31dfb6e2c88519?d=identicon)[eegusakov](/maintainers/eegusakov)

---

Top Contributors

[![eegusakov](https://avatars.githubusercontent.com/u/85644473?v=4)](https://github.com/eegusakov "eegusakov (73 commits)")

---

Tags

geogeocodinggeolocationlocatorphpsearchsearching

###  Code Quality

TestsPHPUnit

Static AnalysisRector

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/eegusakov-geo-search/health.svg)

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

###  Alternatives

[tempest/framework

The PHP framework that gets out of your way.

2.2k34.4k15](/packages/tempest-framework)[cakephp/cakephp

The CakePHP framework

8.9k19.5M1.8k](/packages/cakephp-cakephp)[laravel/framework

The Laravel Framework.

34.8k543.8M19.9k](/packages/laravel-framework)[flow-php/flow

PHP ETL - Extract Transform Load - Data processing framework

85036.3k](/packages/flow-php-flow)[civicrm/civicrm-core

Open source constituent relationship management for non-profits, NGOs and advocacy organizations.

751291.4k41](/packages/civicrm-civicrm-core)[algolia/algoliasearch-client-php

API powering the features of Algolia.

69735.1M157](/packages/algolia-algoliasearch-client-php)

PHPackages © 2026

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