BLACK FRIDAY DEAL!
Get $100 OFF on lifetime access!

PHP / Laravel Integration

Integrate PureSignup with Laravel, Symfony, or any PHP application.

Basic Implementation

PureSignupClient.php
<?php

class PureSignupClient {
    private $apiKey;
    private $baseUrl = 'https://puresignup.com/api/v1';
    
    public function __construct($apiKey = null) {
        $this->apiKey = $apiKey ?? getenv('PureSignup_API_KEY');
    }
    
    public function checkEmail($email) {
        $url = $this->baseUrl . '/check?q=' . urlencode($email);
        
        $ch = curl_init();
        curl_setopt_array($ch, [
            CURLOPT_URL => $url,
            CURLOPT_RETURNTRANSFER => true,
            CURLOPT_TIMEOUT => 5,
            CURLOPT_HTTPHEADER => [
                'Authorization: Bearer ' . $this->apiKey
            ]
        ]);
        
        $response = curl_exec($ch);
        $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
        curl_close($ch);
        
        if ($httpCode !== 200) {
            return null; // Fail open
        }
        
        $data = json_decode($response, true);
        return $data['data'] ?? null;
    }
    
    public function isDisposable($email) {
        $result = $this->checkEmail($email);
        return $result && $result['risk_level'] === 'high';
    }
}

// Usage
$client = new PureSignupClient();
if ($client->isDisposable('user@guerrillamail.com')) {
    echo 'Disposable email detected!';
}

Laravel Integration

app/Rules/NotDisposableEmail.php
<?php

namespace App\Rules;

use Illuminate\Contracts\Validation\Rule;
use App\Services\PureSignupClient;

class NotDisposableEmail implements Rule {
    public function passes($attribute, $value) {
        $client = new PureSignupClient();
        return !$client->isDisposable($value);
    }
    
    public function message() {
        return 'Disposable email addresses are not allowed.';
    }
}
Usage in Controller
<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use App\Rules\NotDisposableEmail;

class AuthController extends Controller {
    public function signup(Request $request) {
        $validated = $request->validate([
            'email' => ['required', 'email', new NotDisposableEmail()],
            'password' => 'required|min:8',
            'name' => 'required'
        ]);
        
        // Create user...
        return response()->json(['message' => 'Signup successful']);
    }
}

Next Steps

© 2025 PureSignup. All rights reserved.