Skip to content

A Laravel plugin to get proxy host from the service jhao104/proxy_pool provides

License

Notifications You must be signed in to change notification settings

sicaboy/laravel-http-proxy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Laravel HTTP Proxy Pool

Build Status Latest Stable Version Total Downloads Latest Unstable Version License

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();

Testing

Contribute

https://github.com/sicaboy/laravel-http-proxy/pulls

About

A Laravel plugin to get proxy host from the service jhao104/proxy_pool provides

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages