Looking to hire Laravel developers? Try LaraJobs

ipstack-laravel maintained by skapelapp

Description
Get information from a visitor's IP address using IPStack and use it in your Laravel project.
Author
Last update
2023/12/08 15:10 (dev-main)
License
Downloads
228

Comments
comments powered by Disqus

IPStack Laravel Package

Packagist Packagist Downloads GitHub

Requirements

Installation

You can add the package to your Laravel project using Composer:

composer require skapelapp/ipstack-laravel

Configuration

1. Set your IPStack API Key in your .env file:

IPSTACK_API_KEY=your-ipstack-api-key

2. Run the following command to publish the configuration:

php artisan vendor:publish --tag=ipstack-laravel-config

3. Service Provider and Alias Configuration:

'providers' => [
    // ...
    Skapelapp\IpstackLaravel\IpstackLaravelServiceProvider::class,
],

'aliases' => [
    // ...
    'IPStack' => Skapelapp\IpstackLaravel\Facades\IPStack::class,
],

Usage

use Skapelapp\IPStackLaravel\IPStack;

// Create an instance of the IPStack class and provide your API key
$apiKey = config('ipstack.api_key');
$ipstack = new IPStack($apiKey);

// Use the getInfo method to retrieve information
$ipInfo = $ipstack->getInfo();

// Make use of the returned information
// dd($ipInfo);

Testing

composer test

Updates

composer update skapelapp/ipstack-laravel

License

This package is licensed under the MIT License. For detailed information, see the LICENSE file.