ProxyMan is OpenSource library for PHP, that makes work with proxies easy!

0.1.4 2020-06-30 11:18 UTC

This package is auto-updated.

Last update: 2020-07-30 11:32:33 UTC


Total Downloads GitHub Version Last Commit PHP Req License

ProxyMan is OpenSource library for PHP, that makes work with proxies easy!

It providing useful proxy manager, that contains any count of proxies, makes automatic connection test and provides easy to use proxy server information



This library is supported by PHP versions 5.4 or higher.


The preferred way to install this extension is through Composer.

To install PHP ErrorHandler library, simply:

$ composer require tregor/proxyman

You can also clone the complete repository with Git:

$ git clone

Quick Start and Usage

You can see more in example.php file.

use tregor\ProxyMan\Exception\ProxyException;
use tregor\ProxyMan\ProxyManager;

//Adding proxy to manager
ProxyManager::addProxyHTTP("", "3128");

//Simple Curl request with proxy
$ch = curl_init("");

    //Getting random proxy from Manager
    $proxy = ProxyManager::getRandomProxy();
}catch (ProxyException $e){
	echo "Error occurred: ".$e->getMessage();

//Setting Curl proxy type by Proxy method
curl_setopt($ch, CURLOPT_PROXYTYPE, $proxy->getType());

//Setting Curl proxy host and port string by Proxy method
curl_setopt($ch, CURLOPT_PROXY, $proxy->getHostPort());

if ($proxy->hasAuth()){
	//Setting Curl proxy username and password string by Proxy method
	curl_setopt($ch, CURLOPT_PROXYUSERPWD, $proxy->getUserPass());

$response = curl_exec($ch);

echo "<pre>".$response."</pre>";

Available Methods

Available methods in this library:

- Adding proxy:

This will add proxy to your proxy list. You must to chose method that coresponds your proxy type (HTTP, HTTPS, SOCKS4, SOCKS5).

ProxyManager::addProxyHTTP(string $host, string $port, string $username = "", string $password = "");
ProxyManager::addProxyHTTPS(string $host, string $port, string $username = "", string $password = "");
ProxyManager::addProxySOCKS4(string $host, string $port, string $username = "", string $password = "");
ProxyManager::addProxySOCKS5(string $host, string $port, string $username = "", string $password = "");

- Get random proxy

This will return one of your proxies, after it automatic test.


- Get all available proxies

This will return array of your proxies, that is current available.


- Check proxy is alive

This will try to connect to provided URL through your proxy.

$proxy->checkConnection(string $url = "", string $method = "GET", int $timeout = 1);

- Get proxy information

This will return array with proxy info. Array contains: proxy type, host, port, username, password, ping in ms (if connection through proxy was tested).


- Proxy auth

This will return boolean TRUE if proxy server needs auth or FALSE if doesn't.



  • Make tests.
  • Improve documentation.
  • Refactor code.
  • Make it better.
  • Take a cup of coffee.


If you would like to help, please take a look at the list of issues or the ToDo checklist.

Pull requests


This project is licensed under MIT license. See the LICENSE file for more info.


By tregor 2020

Please let me know, if you have feedback or suggestions.

You can contact me on Facebook or through my email.