Integration

Use Shifter with PHP

Wire Shifter's residential and ISP proxies into any PHP project — cURL, Guzzle, Symfony HttpClient, Laravel, or WordPress — without changing a single line of business logic.

Quick Start

Install

composer require guzzlehttp/guzzle

Basic Usage

<?php
require 'vendor/autoload.php';

use GuzzleHttp\Client;

$client = new Client([
    'proxy' => 'customer-USERNAME-country-us-sid-123ABC:PASSWORD@p.shifter.io:443',
    'timeout' => 30,
]);

$response = $client->get('https://ipinfo.io/json');
$data = json_decode($response->getBody(), true);

print_r($data);
// ["ip" => "154.16.xxx.xxx", "city" => "New York", "country" => "US", ...]

Features

Works with cURL, Guzzle, Symfony HttpClient, Laravel Http, and WordPress wp_remote_get out of the box
Per-request rotation by default, with `sid` for sticky sessions and `ttl-N` for timed pins of N seconds
Compatible with PHP 7.4 and every PHP 8.x release including 8.3
HTTP, HTTPS, and SOCKS5 protocols on the same gateway endpoint
Geo-targeting in 195+ countries via username parameters — no extra package required
Drop-in for Laravel, Symfony, WordPress, and any custom PHP framework — no SDK lock-in

Examples

Plain cURL

Zero dependencies — just the standard PHP cURL extension. Use this when you can't (or don't want to) install Composer packages.

<?php
$proxyUser = 'customer-USERNAME-country-us-sid-123ABC';
$proxyPass = 'PASSWORD';
$proxyHost = 'p.shifter.io:443';

$ch = curl_init();
curl_setopt_array($ch, [
    CURLOPT_URL            => 'https://example.com',
    CURLOPT_PROXY          => $proxyHost,
    CURLOPT_PROXYUSERPWD   => "$proxyUser:$proxyPass",
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_TIMEOUT        => 30,
    CURLOPT_FOLLOWLOCATION => true,
    CURLOPT_HTTPHEADER     => [
        'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36',
    ],
]);

$body   = curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);

echo "Status: $status, Length: " . strlen($body) . "\n";

Guzzle with Sticky Session

Reuse the same residential IP across a multi-step workflow by adding a `sid` to the username. Add `country-de`, `city-berlin`, or `asn-7922` to geo-target.

<?php
require 'vendor/autoload.php';

use GuzzleHttp\Client;

$sid = bin2hex(random_bytes(4));

$client = new Client([
    'proxy'    => "customer-USERNAME-country-de-city-berlin-sid-$sid-ttl-300:PASSWORD@p.shifter.io:443",
    'timeout'  => 30,
    'headers'  => [
        'User-Agent' => 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36',
    ],
]);

$login     = $client->post('https://example.de/login', [
    'form_params' => ['email' => 'user@example.com', 'password' => 'secret'],
]);
$dashboard = $client->get('https://example.de/dashboard');
$orders    = $client->get('https://example.de/orders');

echo $login->getStatusCode(), ' ', $dashboard->getStatusCode(), ' ', $orders->getStatusCode();

Symfony HttpClient

Symfony's HttpClient component speaks HTTP / 2 and ships with Symfony 6+ and 7. Configure the proxy globally or per request.

<?php
use Symfony\Component\HttpClient\HttpClient;

$client = HttpClient::create([
    'proxy'   => 'customer-USERNAME-country-fr-sid-456DEF:PASSWORD@p.shifter.io:443',
    'timeout' => 30,
    'headers' => [
        'User-Agent' => 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36',
    ],
]);

$response = $client->request('GET', 'https://api.example.fr/products');

if ($response->getStatusCode() === 200) {
    $products = $response->toArray();
    foreach ($products as $product) {
        echo "{$product['name']}: {$product['price']} EUR\n";
    }
}

Laravel HTTP Client

Laravel's Http facade wraps Guzzle. Configure the proxy in a service provider so every Http call your app makes routes through Shifter.

<?php
namespace App\Providers;

use Illuminate\Support\Facades\Http;
use Illuminate\Support\ServiceProvider;

class HttpServiceProvider extends ServiceProvider
{
    public function boot(): void
    {
        Http::macro('shifter', function (string $sid = '') {
            $sidPart = $sid ? "-sid-$sid" : '';
            $proxy   = "customer-USERNAME-country-uk$sidPart:PASSWORD@p.shifter.io:443";

            return Http::withOptions([
                'proxy'           => $proxy,
                'timeout'         => 30,
                'connect_timeout' => 10,
            ]);
        });
    }
}

// Anywhere in your app:
$response = Http::shifter('789GHI')->get('https://example.co.uk/products');
$products = $response->json();
FAQ

Frequently asked FAQ questions

Common questions about using Shifter with PHP.

Use curl_setopt with CURLOPT_PROXY set to `p.shifter.io:443` and CURLOPT_PROXYUSERPWD set to `customer-USERNAME-country-us-sid-123ABC:PASSWORD`. No additional libraries required — the standard PHP cURL extension is enough.

Get started

Start Using Shifter with PHP

Plug Shifter's 205M+ residential and ISP proxies into your PHP stack in under 5 minutes. Works with Laravel, Symfony, WordPress, and plain cURL.

Try Shifter for FreeSet up in minutes. Cancel anytime.