PHPackages                             thbappy7706/geo-details - 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. thbappy7706/geo-details

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

thbappy7706/geo-details
=======================

A simple and intuitive PHP package for retrieving geolocation details from an IP address, including latitude, longitude, timezone, currency, and more.

v1.0.0(1y ago)05MITPHPPHP ^8.0

Since Nov 5Pushed 1y ago1 watchersCompare

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

READMEChangelogDependencies (2)Versions (2)Used By (0)

GeoDetails
==========

[](#geodetails)

GeoDetails is a PHP package designed to retrieve geolocation information based on a given IP address. This package can fetch details like latitude, longitude, timezone, and currency, making it ideal for integration into PHP or Laravel projects.

Table of Contents
-----------------

[](#table-of-contents)

- [Installation](#installation)
- [Configuration](#configuration)
- [Usage](#usage)
- [Available Methods](#available-methods)
- [Error Handling](#error-handling)
- [Helper Functions](#helper-functions)
- [License](#license)
- [Contributing](#contributing)
- [Author](#author)

---

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

[](#installation)

Install the `geo-details` package using Composer:

```
composer require thbappy7706/geo-details
```

This will add the package to your project’s dependencies.

Configuration
-------------

[](#configuration)

This package uses GuzzleHttp for making HTTP requests. Ensure that Guzzle is included in your project (it should be installed automatically as a dependency).

Usage
-----

[](#usage)

After installing, you can use the package by creating an instance of the GeoLocationService class or by using helper functions.

Example: Using GeoLocationService Class

```
require 'vendor/autoload.php';

use GeoDetails\GeoLocationService;

// Instantiate the GeoLocationService class
$geoService = new GeoLocationService();

// Specify the IP address you want to retrieve details for
$ip = '8.8.8.8';

// Fetch and display geolocation details
$latitude = $geoService->getLatitude($ip);
$longitude = $geoService->getLongitude($ip);

if ($latitude !== null && $longitude !== null) {
    echo "Latitude: " . $latitude . ", Longitude: " . $longitude;
} else {
    echo "Error: Unable to retrieve location details.";
}
```

Available Methods
-----------------

[](#available-methods)

The GeoLocationService class provides methods to retrieve specific details for a given IP address.

Method List
-----------

[](#method-list)

getLatitude($ip): Returns the latitude of the specified IP address. getLongitude($ip): Returns the longitude of the specified IP address. getTimezone($ip): Returns the timezone of the specified IP address. getCurrency($ip): Returns the currency of the specified IP address. getDetails($ip): Returns the full API response, including all available details. Method Parameters $ip: The IP address to retrieve geolocation details for (e.g., '8.8.8.8'). Example of Each Method

```
$geoService = new GeoLocationService();
$ip = '8.8.8.8';

echo "Latitude: " . $geoService->getLatitude($ip) . PHP_EOL;
echo "Longitude: " . $geoService->getLongitude($ip) . PHP_EOL;
echo "Timezone: " . $geoService->getTimezone($ip) . PHP_EOL;
echo "Currency: " . $geoService->getCurrency($ip) . PHP_EOL;
```

Error Handling
--------------

[](#error-handling)

If the IP address is invalid or if there’s an issue with the request, the methods return null.

Error Example If the API response contains an error, such as:

```
$latitude = $geoService->getLatitude('127.0.0.1:8000');

if ($latitude === null) {
    echo "Error: Unable to retrieve latitude.";
} else {
    echo "Latitude: " . $latitude;
}
```

Or, when using getDetails:

```
$details = $geoService->getDetails('127.0.0.1:8000');

if (isset($details['error']) && $details['error']) {
    echo "Error: " . $details['reason'];
} else {
    echo "Details retrieved successfully.";
}
```

Helper Functions
----------------

[](#helper-functions)

The package provides helper functions for convenience, so you don’t have to instantiate GeoLocationService directly.

Available Helper Functions
--------------------------

[](#available-helper-functions)

```
$ip = '8.8.8.8';

echo "Latitude: " . getLatitude($ip) . PHP_EOL;
echo "Longitude: " . getLongitude($ip) . PHP_EOL;
echo "Timezone: " . getTimezone($ip) . PHP_EOL;
echo "Currency: " . getCurrency($ip) . PHP_EOL;
```

License
-------

[](#license)

This package is licensed under the MIT License. See the LICENSE file for details.

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

[](#contributing)

Contributions are welcome! Please open issues or submit pull requests with improvements or bug fixes. For significant changes, open an issue first to discuss your proposed changes.

Author
======

[](#author)

### Created by Tanvir Hossen Bappy

[](#created-by-tanvir-hossen-bappy)

###  Health Score

25

—

LowBetter than 35% of packages

Maintenance35

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity44

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 90.9% 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

Unknown

Total

1

Last Release

607d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/3d7b86a335fd7f9c38167079c3c9added0d159a736cf322d2fe9039f86d9d324?d=identicon)[thbappy](/maintainers/thbappy)

---

Top Contributors

[![thbappygit](https://avatars.githubusercontent.com/u/147967523?v=4)](https://github.com/thbappygit "thbappygit (10 commits)")[![thbappy7706](https://avatars.githubusercontent.com/u/26590361?v=4)](https://github.com/thbappy7706 "thbappy7706 (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/thbappy7706-geo-details/health.svg)

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

###  Alternatives

[aws/aws-sdk-php

AWS SDK for PHP - Use Amazon Web Services in your PHP project

6.3k543.5M2.6k](/packages/aws-aws-sdk-php)[neuron-core/neuron-ai

The PHP Agentic Framework.

2.0k656.1k39](/packages/neuron-core-neuron-ai)[tencentcloud/tencentcloud-sdk-php

TencentCloudApi php sdk

3741.3M46](/packages/tencentcloud-tencentcloud-sdk-php)[civicrm/civicrm-core

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

751291.4k43](/packages/civicrm-civicrm-core)[spatie/laravel-export

Create a static site bundle from a Laravel app

674146.0k6](/packages/spatie-laravel-export)[oat-sa/tao-core

TAO core extension

66143.7k124](/packages/oat-sa-tao-core)

PHPackages © 2026

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