victorybiz/geoip-location 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

victorybiz/geoip-location

最新稳定版本:v1.1.10

Composer 安装命令:

composer require victorybiz/geoip-location

包简介

Get the geographical location of website visitors based on their IP addresses. Support Laravel and PHP (Non-Laravel) Project.

README 文档

README

GitHub release Software License Build Status Packagist

Get the geographical location of website visitors based on their IP addresses. Support Laravel and PHP (Non-Laravel) Project.

Installation

Install using composer, from the command line run:

$ composer require victorybiz/geoip-location

Laravel Project

Alternatively, you can add "victorybiz/geoip-location": "^1.1" to your composer.json file's require section and then you'll then need to run composer install or composer update to download it and have the autoloader updated.

If you use Laravel >= 5.5 you can skip this step and go to usage

If you use Laravel < 5.5, you need to register the service provider with the application. Open up config/app.php and locate the providers key.

'providers' => [

    Victorybiz\GeoIPLocation\GeoIPLocationServiceProvider::class,

]

And add the GeoIPLocation alias to config/app.php:

'aliases' => [

	'GeoIPLocation' => Victorybiz\GeoIPLocation\Facades\GeoIPLocationFacade::class,

]

Usage in Laravel Project

Please use the GeoIPLocation Facade

use GeoIPLocation;

echo GeoIPLocation::getIP(); // Return client IP

PHP (Non-Laravel) Project

Require the vendor autoload file in your php script.

    require_once 'path/to/vendor/autoload.php';

Usage

Localhost IP 127.0.0.1, 192.168.65.0, 172.18.0.1 and ::1 will return 169.159.82.111 to assert a valid geo response.

    use Victorybiz\GeoIPLocation\GeoIPLocation;

    $geoip = new GeoIPLocation(); 

    // OR

    $geoip = new GeoIPLocation([
        'ip' => null, // Set IP.  Default is NULL, will be auto set by the package
        'baseCurrency' => 'USD', // Set base currency for exchange rate. Default is USD
    ]);

Alternatively

    $geoip = new \Victorybiz\GeoIPLocation\GeoIPLocation();

    // OR

    $geoip = new \Victorybiz\GeoIPLocation\GeoIPLocation([
        'ip' => null, // Set IP.  Default is NULL, will be auto set by the package
        'baseCurrency' => 'USD', // Set base currency for exchange rate. Default is USD
    ]);

You're good to go, explore the package

    echo $geoip->getIP(); // Return client IP

    echo $geoip->setIP('0.0.0.0'); // Set an IP to get its geographical location

    echo $geoip->getCity(); // Return client IP City (null if none)

    echo $geoip->getRegion(); // Return client IP Region (null if none)

    echo $geoip->getRegionCode(); // Return client IP Region Code (null if none)

    echo $geoip->getCountry(); // Return client IP Country

    echo $geoip->getCountryCode(); // Return client IP Country Code

    echo $geoip->getContinent(); // Return client IP Continent 

    echo $geoip->getContinentCode(); // Return client IP Continent Code

    echo $geoip->getPostalCode(); // Return client IP Postal Code (null if none)

    echo $geoip->getLatitude(); // Return client IP Latitude (null if none)

    echo $geoip->getLongitude(); // Return client IP Longitude (null if none)

    echo $geoip->getCurrencyCode(); // Return client IP Country Currency Code (null if none)

    echo $geoip->getCurrencySymbol(); // Return client IP Country Currency Symbol (null if none)

    echo $geoip->getCurrencyExchangeRate(); // Return client IP Country Currency Exchange Rate against NGN (null if none)

    echo $geoip->getLocation(); // Return client IP Location string (city, region, country)

Web Services

Bug Reports and Issue tracking

Kindly make use of the issue tracker for bug reports, feature request, additional web service request and security issues.

License

MIT

统计信息

  • 总下载量: 151.37k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 23
  • 点击次数: 2
  • 依赖项目数: 2
  • 推荐数: 0

GitHub 信息

  • Stars: 22
  • Watchers: 1
  • Forks: 4
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 未知

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固