Package Data | |
---|---|
Maintainer Username: | groundsix |
Maintainer Contact: | james.fenwick@groundsix.com (James Fenwick) |
Package Create Date: | 2016-08-19 |
Package Last Update: | 2016-11-09 |
Home Page: | |
Language: | PHP |
License: | proprietary |
Last Refreshed: | 2024-12-14 15:00:59 |
Package Statistics | |
---|---|
Total Downloads: | 5,331 |
Monthly Downloads: | 5 |
Daily Downloads: | 0 |
Total Stars: | 2 |
Total Watchers: | 5 |
Total Forks: | 1 |
Total Open Issues: | 0 |
This package allows email to be easily checked against https://neverbounce.com/.
Once installed you can do stuff like this:
$this->validate($request, [
'email' => 'neverbounce',
]);
or
NeverBounce::valid($email);
You can install the package via composer:
$ composer require ground/laravel-neverbounce
This service provider must be installed.
// config/app.php
'providers' => [
...
Groundsix\Neverbounce\NeverBounceServiceProvider::class,
];
'aliases' => [
...
'NeverBounce' => Groundsix\Neverbounce\Facades\NeverBounce::class,
];
You can publish the config-file with:
php artisan vendor:publish --provider="Groundsix\Neverbounce\NeverBounceServiceProvider" --tag="config"
And your Neverbounce api details should be added to .env
:
NEVERBOUNCE_USERNAME=<username>
NEVERBOUNCE_SECRET_KEY=<secret key>
This package registers the Neverbounce\API\NB_Single
into the application. But for conveniance provides a facade and a validator to simplify checking an email address.
class AuthController extends Controller
{
protected function validator(array $data)
{
return Validator::make($data, [
'email' => 'required|email|max:255|unique:users|neverbounce',
'password' => 'required|min:6|confirmed',
]);
}
}
...
use NeverBounce;
class AuthController extends Controller
{
protected function storeEmail(Request $request)
{
if(NeverBounce::valid($request->get('email'))){
//do something
}
}
}
Or you can access NB_Single
directly. See https://github.com/NeverBounce/NeverBounceAPI-PHP#single for more details.
...
use NeverBounce\API\NB_Single;
class AuthController extends Controller
{
protected function storeEmail(Request $request)
{
if(app(NB_Single::class)->valid($request->get('email'))->is(NB_Single::GOOD)){
//do something
}
}
}