Skip to content

usevalid-email/laravel-sdk

Repository files navigation

usevalid.email Laravel SDK

PHP Composer

Latest Version on Packagist Total Downloads License

Validate Your Emails with Confidence

Installation

You can install the package via composer:

composer require usevalid-email/laravel-sdk

Usage

Initialization

use UseValidEmail\LaravelSdk\LaravelSdk;

$token = 'your-access-token';
$sdk = new LaravelSdk($token);

Validate Email

use Illuminate\Support\Facades\Validator;

$validator = Validator::make(['email' => 'test@example.com'], [
    'email' => 'valid_email',
]);

if ($validator->fails()) {
    echo "Invalid email.";
} else {
    echo "Valid email.";
}

Controller Example

Here is an example of how to use the valid_email validator in a Laravel controller:

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;

class EmailValidationController extends Controller
{
    public function validateEmail(Request $request): \Illuminate\Http\RedirectResponse
    {
        $request->validate([
            'email' => 'required|email|valid_email',
        ]);

        return back()->with('success', 'Valid email.');
    }
}

Testing

composer test

Contributing

Please see CONTRIBUTING for details.

Credits

License

The MIT License (MIT). Please see License File for more information.

About

usevalid.email Laravel SDK

Topics

Resources

License

Stars

Watchers

Forks

Sponsor this project

Contributors 2

  •  
  •  

Languages