定制 codeblog.pro/laravel-geo-location 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

codeblog.pro/laravel-geo-location

Composer 安装命令:

composer require codeblog.pro/laravel-geo-location

包简介

The package allows you to get the location of the user by his IP. The package provides the ability to use several services at the same time to increase accuracy and to increase free limits.

README 文档

README

Build Status Scrutinizer Code Quality Code Coverage Code Intelligence Status Total Downloads Version

The package is a wrapper for several geolocation services at once. The main task of the package is to determine the user's location by IP. Due to the possibility of using several providers at once, the free limit of each provider is summed up.

Install

Via Composer

$ composer require codeblog.pro/geo-location

Usage

// First way: in code
$geoLocationService = new \CodeblogPro\GeoLocation\Application\Services\GeoLocationService();
$location = $geoLocationService->getLocationByIpAndLanguageResultCode('8.8.8.8', 'EN');
var_dump($location);

$locationArray = $geoLocationService->getLocationArrayByIpAndLanguageResultCode('8.8.8.8', 'RU');
var_dump($locationArray);

$currentIpResolver = new \CodeblogPro\GeoLocation\Application\Services\CurrentIpResolver();
$currentIp = $geoLocationService->getCurrentIpByIpResolver($currentIpResolver)->getValue();
var_dump($currentIp);

$locationByIpResolverAndLanguageResultCode = $geoLocationService->getLocationByIpResolverAndLanguageResultCode(
    $currentIpResolver,
    'RU'
);
var_dump($locationByIpResolverAndLanguageResultCode);

// Second way (only for Laravel): using a GET request, 
// for example by url http://<our-domain>/api/geo-location/46.174.50.30/en
// Result: 
// {
//   "data":{
//     "latitude":55.07944,
//     "longitude":38.77833,
//     "country_name":"Russia",
//     "country_code":"RU",
//     "region_name":"Moskovskaya Oblast'",
//     "region_code":"RU-MOS",
//     "street_name":"",
//     "postal_code":"1404xx",
//     "locality":"Kolomna"
//   }
// }

Testing

$ composer test

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email panov@codeblog.pro instead of using the issue tracker.

Credits

License

The Apache License License. Please see License File for more information.

统计信息

  • 总下载量: 54
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 3
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: Apache-2.0
  • 更新时间: 2020-08-06

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固