stopreg/laravel

The official Laravel SDK for StopReg.

Maintainers

Package info

github.com/stopreg/stopreg-laravel

pkg:composer/stopreg/laravel

Statistics

Installs: 0

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v1.0.0 2026-05-14 20:38 UTC

This package is auto-updated.

Last update: 2026-05-14 21:19:22 UTC


README

Latest Version on Packagist License: MIT

The official Laravel SDK for StopReg, providing seamless email and domain verification to protect your Laravel applications from fraudulent registrations.

Features

  • Facade Support: Simple StopReg::checkEmail() syntax.
  • Auto-Discovery: Automatic service provider and facade registration.
  • Configurable: Easily publish and manage your API tokens.
  • Validation-Ready: Perfect for use within Laravel request validation.

Installation

Install the package via composer:

composer require stopreg/laravel

Configuration

Publish the configuration file:

php artisan vendor:publish --tag="stopreg-config"

Then, add your StopReg API token to your .env file:

STOPREG_API_TOKEN=your_api_token_here

Usage

Using the Facade

You can use the StopReg facade to verify emails and domains anywhere in your application.

use StopReg;

// 1. Verify an email address
$result = StopReg::checkEmail('user@disposable.com');

if ($result['data']['classification']['is_disposable']) {
    return back()->withErrors(['email' => 'Please use a permanent email address.']);
}

// 2. Verify a domain
$domainResult = StopReg::checkDomain('gmail.com');
echo $domainResult['data']['domain']['provider']; // "google"

In a Controller

public function register(Request $request)
{
    $verification = StopReg::checkEmail($request->email);
    
    if ($verification['data']['classification']['is_disposable']) {
        // Block registration
    }
}

Domain Verification

$result = StopReg::checkDomain('example.com');

$provider = $result['data']['domain']['provider'];
$mxFound = $result['data']['mail_server']['mx_found'];

Error Handling

The SDK throws an InvalidArgumentException for invalid inputs and StopRegException for API-level errors.

try {
    StopReg::checkEmail('not-an-email');
} catch (\InvalidArgumentException $e) {
    echo $e->getMessage();
}

License

MIT © StopReg