stopreg / laravel
The official Laravel SDK for StopReg.
v1.0.0
2026-05-14 20:38 UTC
Requires
- php: ^8.1
- illuminate/http: ^10.0|^11.0
- illuminate/support: ^10.0|^11.0
Requires (Dev)
- orchestra/testbench: ^8.0|^9.0
- pestphp/pest: ^2.0|^3.0
- pestphp/pest-plugin-laravel: ^2.0|^3.0
README
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