- PHP 5.6 or above
- [Guzzle PHP Framework][guzzle] (included by composer)
- Symfony 2.7 or above (including Symfony 3.x)
To install this bundle, run the command below and you will get the latest version by [Packagist][packagist].
composer require glooby/http-client-bundle dev-master
To use the newest (maybe unstable) version please add following into your composer.json:
{
"require": {
"glooby/http-client-bundle": "dev-master"
}
}
Load bundle in AppKernel.php:
public function registerBundles()
{
$bundles = [
...
new Glooby\HttpClientBundle\GloobyHttpClientBundle(),
...
];
}
Configure in app/config/parameters.yml:
parameters:
...
glooby.http.proxy: socks5://127.0.0.1:1080
parameters:
...
glooby.http.proxy: /etc/proxyfile
$ cat /etc/proxy
socks5://127.0.0.1:1080
Supports single/multiple lines
parameters:
...
glooby.http.proxy:
- http://127.0.0.1:1081
- socks5://127.0.0.1:1080
- socks4://127.0.0.1:1082
parameters:
...
glooby.http.proxy:
- socks5://127.0.0.1:1080
- socks5://john:doe@127.0.0.1:1081
- /etc/proxy1
- /etc/proxy2
When providing multiple proxies a random one will be select each time creating a new client
$ip = $this->get('glooby.http.client')->get('http://api.ipify.org')->getBody();
- http
- https
- socks4
- socks4a
- socks5
- socks5h
This bundle is released under the MIT license