bytes4sale / iplocator
This package will help to provide details information of your provided ip
Installs: 26
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 1
Forks: 1
Open Issues: 0
Type:laravel-package
Requires
- php: ^7.3|^8.0
- laravel/framework: ^8.75
README
Introduction
Welcome to IPLocator, a powerful Laravel package that provides easy-to-use functionality for retrieving detailed information about IP addresses. With this package, you can effortlessly obtain essential details like location, currency, language, and more for any given IP address.
Features
-
Accurate IP Information: IPLocator uses reliable data sources to provide accurate information about the geographical location of an IP address.
-
Currency and Language Details: Retrieve currency and language information associated with the provided IP address.
-
Simple Integration: Seamlessly integrate the IPLocator package into your Laravel projects without hassle.
-
Customizable Options: Customize the package settings to suit your application's requirements.
-
Fast and Efficient: IPLocator is designed to be efficient, ensuring minimal impact on your application's performance.
-
Regular Updates: The package is maintained actively, and updates will be provided regularly to keep the data up-to-date.
Requirements
- Laravel 7.x or higher
- PHP 7.4 or higher
Installation
You can install the IPLocator package via Composer. Run the following command in your terminal:
composer require bytes4sale/iplocator
Prerequisites
Before using IPLocator, you need to sign up for an API key from the IP data providers you wish to use. IPLocator currently supports the following IP data providers, each offering different sets of information. So key is required to access their API to fetch IP information
- IPDATA : You can register and obtain your API key by visiting their website at https://www.ipdata.co.
- IPSTACK : You can register and obtain your API key by visiting their website at https://ipstack.com.
Configuration
Before using the IPLocator package, you need to set your API key and API Source in the .env file of your Laravel project.
- Open your Laravel project's root directory.
- Create or modify the
.env
file and add:
//for IPDATA IP_LOCATOR_SOURCE=IPDATA IPDATA_KEY=your_ipdata_api_key_here, //for IPSTACK IP_LOCATOR_SOURCE=IPSTACK IPSTACK_KEY=your_ipstack_api_key_here, //for IP-API IP_LOCATOR_SOURCE=IP-API
Usage
Getting information for an IP address is a breeze with IPLocator. Simply follow these steps:
-
Initialize IPLocator: Before using the package, make sure to initialize it. You can do this by adding the
ServiceProvider
to theconfig/app.php
file:// config/app.php 'providers' => [ // Other providers... bytes4sale\iplocator\IpLocatorServiceProvider::class, ],
-
Retrieve IP Information: Once the package is initialized, you can easily get the details for an IP address:
use bytes4sale\iplocator\Facades\IPLocator; // Get information for an IP address $ipAddress = '203.0.113.0'; $response = IPLocator::getIpCompleteDetails($ipAddress); if ($response->isSuccessful()) { print_r($response->getTodayRequestCount()); } else { print_r($response->getErrorResponse(); }
Configuration
IPLocator allows you to customize its behavior by publishing its configuration file. To do this, run the following artisan command:
php artisan vendor:publish --tag="iplocator-config"
After running the command, you will find the configuration file at config/iplocator.php. You can modify the settings as per your needs.
Advanced Settings
If you want to save the API keys in the database, you can use the IpLocatorConfig::setCredentials(["key" => "123"])
function to set the API key. Make sure the array key should be "key".
This allows you to securely store and manage your API keys within your application's database, providing a more flexible and configurable way to use the IpLocator package.
Available Methods
Contributions and Bug Reports
We welcome contributions from the community to improve bytes4sale IPLocator. If you find a bug or have a suggestion for a new feature, we encourage you to participate and help make this package even better.
Bug Reports
If you encounter any issues or bugs while using bytes4sale IPLocator, please open an issue in our GitHub repository. When reporting a bug, please provide as much detail as possible, including:
- A clear and descriptive title for the issue.
- Steps to reproduce the bug.
- Information about your PHP and Laravel versions.
- Any relevant error messages or screenshots.
Feature Requests
If you have a new feature idea or enhancement in mind, you can also open an issue in the GitHub repository. Please outline the feature's functionality and the problem it solves or the value it adds to the package.
Contributing
We appreciate contributions from the community to help us improve the package. If you'd like to contribute code, please follow these steps:
- Fork the repository and create a new branch from the
master
branch. - Implement your changes or additions.
- Write tests to ensure the new code functions correctly and update existing tests as needed.
- Make sure all tests pass.
- Create a pull request (PR) to submit your changes. Clearly describe the changes you've made and any related issues or features.
Our team will review your PR, and if everything looks good, we'll merge it into the master
branch.
By contributing to bytes4sale IPLocator, you agree to make your contributions available under this package.
We appreciate the efforts of our contributors, and your help will make the package better for everyone. Thank you!
License
The MIT License (MIT). Please see License File for more information.
Acknowledgments
If you find this package helpful, consider giving credit to the authors and contributors.