ip2location/ip2proxy-laravel
Composer 安装命令:
composer require ip2location/ip2proxy-laravel
包简介
Allows user to query an IP address if it was being used as open proxy, web proxy, VPN anonymizer and TOR exits.
关键字:
README 文档
README
IP2Proxy Laravel extension enables the user to query an IP address if it was being used as VPN servers, open proxies, web proxies, Tor exit nodes, search engine robots, data center ranges, residential proxies, consumer privacy networks, and enterprise private networks.
Note: This extension works in Laravel 6, Laravel 7, Laravel 8 and Laravel 9, Laravel 10, Laravel 11 and Laravel 12.
INSTALLATION
Run the command: composer require ip2location/ip2proxy-laravel to download the package into the Laravel platform.
USAGE
IP2Proxy Laravel extension is able to query the IP address proxy information from either BIN database or web service. This section will explain how to use this extension to query from BIN database and web service.
BIN DATABASE
- Download IP2Proxy BIN database
- IP2Proxy free LITE database at https://lite.ip2location.com
- IP2Proxy commercial database at https://www.ip2location.com/proxy-database
- To use IP2Proxy databases, create a folder named as
ip2proxyin thedatabasedirectory. - Unzip and copy the BIN file into
database/ip2proxy/folder. - Rename the BIN file to IP2PROXY.BIN.
- Create a TestController in Laravel using the below command line
php artisan make:controller TestController
- Open the app/Http/Controllers/TestController.php in any text editor.
- To use IP2Proxy databases, add the below lines into the controller file
<?php namespace App\Http\Controllers; use Illuminate\Http\Request; use IP2ProxyLaravel; //use IP2ProxyLaravel class class TestController extends Controller { //Create a lookup function for display public function lookup(){ //Try query the geolocation information of 1.2.3.4 IP address $records = IP2ProxyLaravel::get('1.2.3.4', 'bin'); echo '<p><strong>IP Address: </strong>' . $records['ipAddress'] . '</p>'; echo '<p><strong>IP Number: </strong>' . $records['ipNumber'] . '</p>'; echo '<p><strong>IP Version: </strong>' . $records['ipVersion'] . '</p>'; echo '<p><strong>Country Code: </strong>' . $records['countryCode'] . '</p>'; echo '<p><strong>Country: </strong>' . $records['countryName'] . '</p>'; echo '<p><strong>State: </strong>' . $records['regionName'] . '</p>'; echo '<p><strong>City: </strong>' . $records['cityName'] . '</p>'; echo '<p><strong>Proxy Type: </strong>' . $records['proxyType'] . '</p>'; echo '<p><strong>Is Proxy: </strong>' . $records['isProxy'] . '</p>'; echo '<p><strong>ISP: </strong>' . $records['isp'] . '</p>'; echo '<p><strong>Domain: </strong>' . $records['domain'] . '</p>'; echo '<p><strong>Usage Type: </strong>' . $records['usageType'] . '</p>'; echo '<p><strong>ASN: </strong>' . $records['asn'] . '</p>'; echo '<p><strong>AS: </strong>' . $records['as'] . '</p>'; echo '<p><strong>Last Seen: </strong>' . $records['lastSeen'] . '</p>'; echo '<p><strong>Threat: </strong>' . $records['threat'] . '</p>'; echo '<p><strong>Provider: </strong>' . $records['provider'] . '</p>'; } }
- Add the following line into the routes/web.php file.
Route::get('test', 'App\Http\Controllers\TestController@lookup');
- Enter the URL /test and run. You should see the information of 1.2.3.4 IP address.
WEB SERVICE
- To use IP2Location.io or IP2Proxy Web Service, create a new file called "site_vars.php" in
configdirectory. - In the site_vars.php, save the following contents for IP2Location.io:
<?php
return [
'IP2LocationioAPIKey' => 'your_api_key', // Required. Your IP2Location.io API key.
'IP2LocationioLanguage' => 'en', // Optional. Refer to https://www.ip2location.io/ip2location-documentation for available languages.
];
Or save the following contents for IP2Proxy:
<?php return [ 'IP2ProxyAPIKey' => 'your_api_key', // Required. Your IP2Proxy API key. 'IP2ProxyPackage' => 'PX1', // Required. Choose the package you would like to use. 'IP2ProxyUsessl' => false, // Optional. Use https or http. ];
- Create a TestController in Laravel using the below command line
php artisan make:controller TestController
- Open the app/Http/Controllers/TestController.php in any text editor.
- To use IP2Proxy Web Service, add the below lines into the controller file.
<?php namespace App\Http\Controllers; use Illuminate\Http\Request; use IP2ProxyLaravel; //use IP2ProxyLaravel class class TestController extends Controller { //Create a lookup function for display public function lookup(){ //Try query the geolocation information of 1.2.3.4 IP address $records = IP2ProxyLaravel::get('1.2.3.4', 'ws'); echo '<pre>'; print_r($records); echo '</pre>'; } }
- Add the following line into the routes/web.php file.
Route::get('test', 'App\Http\Controllers\TestController@lookup');
- Enter the URL /test and run. You should see the information of 1.2.3.4 IP address.
DEPENDENCIES (IP2PROXY BIN DATA FILE)
This library requires IP2Proxy BIN data file to function. You may download the BIN data file at
- IP2Proxy LITE BIN Data (Free): https://lite.ip2location.com
- IP2Proxy Commercial BIN Data (Comprehensive): https://www.ip2location.com/proxy-database
SUPPORT
Email: support@ip2location.com
Website: https://www.ip2location.com
ip2location/ip2proxy-laravel 适用场景与选型建议
ip2location/ip2proxy-laravel 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 70.45k 次下载、GitHub Stars 达 10, 最近一次更新时间为 2017 年 10 月 03 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「proxy」 「laravel」 「ip2proxy」 「laravel 6」 「laravel 7」 「laravel 8」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 ip2location/ip2proxy-laravel 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 ip2location/ip2proxy-laravel 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 ip2location/ip2proxy-laravel 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
PHP module to check if an IP address was being used as open proxy, web proxy, VPN anonymizer and TOR exits.
Lazy loading for middleware and request handlers
PHP module to check if an IP address was being used as open proxy, web proxy, VPN anonymizer and TOR exits via IP2Proxy API.
Get working public proxy list for free by PubProxy (No API key required).
Alfabank REST API integration
Standalone proxy server in PHP sockets, I am using Guzzle to route the requests. Idea was if I can make HTTP Proxy Server in php to get more control over proxy and custom logic. Currently it only supports http requests you can choose port of your own choice plus if you want to make it public or priv
统计信息
- 总下载量: 70.45k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 10
- 点击次数: 29
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2017-10-03