rayblair/numverifywrapper
Composer 安装命令:
composer require rayblair/numverifywrapper
包简介
A Wrapper for Number Verification Api's such as numverify
README 文档
README
Installation
composer require rayblair/numverifywrapper
Laravel Integration
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, ],
Adding Api Key
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="
Laravel
Setting variables and verify
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();
Shorthand method
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");
Just return validation result
// Returns either turn or false depending on api result Numverify::isValid();
Without Laravel
require_once "vendor/autoload.php"; $data['api_key'] = "<Numverify Api Key>"; $numverify = new Rayblair\NumverifyWrapper\NumverifyService($data); $numverify->setNumber("1234567890")->setCountryCode("GB")->verify();
License
NumverifyWrapper is licensed under the MIT License.
Copyright 2018 Ray Blair
统计信息
- 总下载量: 714
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2018-08-28