Download the PHP package thbappy7706/geo-details without Composer
On this page you can find all versions of the php package thbappy7706/geo-details. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download thbappy7706/geo-details
More information about thbappy7706/geo-details
Files in thbappy7706/geo-details
Package geo-details
Short Description A simple and intuitive PHP package for retrieving geolocation details from an IP address, including latitude, longitude, timezone, currency, and more.
License MIT
Informations about the package geo-details
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
- Installation
- Configuration
- Usage
- Available Methods
- Error Handling
- Helper Functions
- License
- Contributing
- Author
Installation
Install the geo-details package using Composer:
This will add the package to your project’s dependencies.
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
After installing, you can use the package by creating an instance of the GeoLocationService class or by using helper functions.
Example: Using GeoLocationService Class
Available Methods
The GeoLocationService class provides methods to retrieve specific details for a given IP address.
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
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:
Or, when using getDetails:
Helper Functions
The package provides helper functions for convenience, so you don’t have to instantiate GeoLocationService directly.
Available Helper Functions
License
This package is licensed under the MIT License. See the LICENSE file for details.
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.