sicaboy / laravel-http-proxy
There is no license information available for the latest version (0.2.1) of this package.
A package allows HTTP proxy
0.2.1
2018-09-05 12:21 UTC
Requires
- illuminate/support: 5.0.*|5.1.*|5.2.*|5.3.*|5.4.*|5.5.*|5.6.*|5.7.*
Requires (Dev)
- phpunit/phpunit: ~4.8
This package is auto-updated.
Last update: 2025-01-06 10:28:56 UTC
README
Installation
composer require sicaboy/laravel-http-proxy
Setup Service
https://github.com/jhao104/proxy_pool
Laravel 5
Setup
NOTE This package supports the auto-discovery feature of Laravel 5.5, So skip these Setup
instructions if you're using Laravel 5.5.
In app/config/app.php
add the following :
1- The ServiceProvider to the providers array :
Sicaboy\LaravelHttpProxy\HttpProxyServiceProvider::class,
2- The class alias to the aliases array :
'HttpProxy' => Sicaboy\LaravelHttpProxy\Facades\HttpProxy::class,
3- Publish the config file
php artisan vendor:publish --provider="Sicaboy\LaravelHttpProxy\HttpProxyServiceProvider"
Configuration
Add lines in .env file :
HTTP_PROXY_PROTOCOL=http
HTTP_PROXY_HOST=127.0.0.1
HTTP_PROXY_PORT=5010
HTTP_PROXY_CACHE_ENABLED=false
HTTP_PROXY_CACHE_KEY=laravel-http-proxy
HTTP_PROXY_CACHE_TTL=300
Usage
use Sicaboy\LaravelHttpProxy\Facades\HttpProxy; // Get a valid proxy. e.g."12.34.56.78:8080" $proxy = HttpProxy::getProxy(); // Give up the current cached proxy and get another valid proxy $proxy = HttpProxy::refreshProxy();