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 1mo ago

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 37% of packages

Maintenance38

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity43

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

553d 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

[shlinkio/shlink

A self-hosted and PHP-based URL shortener application with CLI and REST interfaces

4.8k4.3k](/packages/shlinkio-shlink)[ralphjsmit/laravel-helpers

A package containing handy helpers for your Laravel-application.

13704.6k2](/packages/ralphjsmit-laravel-helpers)[dhlparcel/magento2-plugin

DHL Parcel plugin for Magento 2

11180.5k2](/packages/dhlparcel-magento2-plugin)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

255.2k](/packages/aedart-athenaeum)

PHPackages © 2026

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