composer require rayblair/numverifywrapper
Add the service provider to your config/app.php
file:
'providers' => [
// ...
Rayblair\NumverifyWrapper\NumverifyServiceProvider::class,
],
Add the facade to your config/app.php
file:
'aliases' => [
// ...
'Numverify' => Rayblair\NumverifyWrapper\Facades\Numverify::class,
],
If you haven't already go to http://numverify.com and register for an api key.
Publish the config file php artisan vendor:publish
then either replace the environment variable within the config or place your api key within your .env as "NUMVERIFY_API_KEY="
You can set the object variables for number and country code with the below methods then run the verify() method to verify the set values.
Numverify::setNumber("1234567890");
Numverify::setCountryCode("GB");
Numverify::verify();
Alternatively you can stack them altogether.
Numverify::setNumber("1234567890")->setCountryCode("GB")->verify();
You can also just pass the phone number and the country code through the verify()
method
Numverify::verify("+441234567890");
// OR
Numverify::verify("1234567890", "GB");
Or use the numverify()
helper function.
numverify("1234567890");
// OR
numverify("1234567890", "GB");
// Returns either turn or false depending on api result
Numverify::isValid();
require_once "vendor/autoload.php";
$data['api_key'] = "<Numverify Api Key>";
$numverify = new Rayblair\NumverifyWrapper\NumverifyService($data);
$numverify->setNumber("1234567890")->setCountryCode("GB")->verify();
NumverifyWrapper is licensed under the MIT License.
Copyright 2018 Ray Blair