苏科/google-safe-browsing
一个用于通过谷歌安全浏览API检查特定URL是否安全的Laravel包。
2.0.1
2016-03-03 19:34 UTC
Requires
- laravel/framework: ~5.0
This package is not auto-updated.
Last update: 2024-09-15 00:20:53 UTC
README
一个用于通过谷歌安全浏览API检查特定URL是否安全的Laravel包。
本包受 winternight/google-safe-browsing 启发(但遗憾的是,我无法通过composer安装此包。)
(适用于Laravel 5+。)
安装
执行composer命令。
composer require sukohi/google-safe-browsing:2.*
在app.php中注册服务提供者
'providers' => [
...Others...,
Sukohi\GoogleSafeBrowsing\GoogleSafeBrowsingServiceProvider::class,
]
也别名
'aliases' => [
...Others...,
'GoogleSafeBrowsing' => Sukohi\GoogleSafeBrowsing\Facades\GoogleSafeBrowsing::class
]
准备
1.您需要获取谷歌安全浏览API的API密钥。
2.发布配置文件。
php artisan vendor:publish --force
3.在YOUR-APP/config/google_safe_browsing.php
中将您的API密钥设置如下。
'api_key' => '*************************************'
基本用法
if(GoogleSafeBrowsing::isSecure('https://github.com/SUKOHI')) {
echo 'Secure!';
}
获取更多详细信息
在调用isSecure('URL')后,调用您想要的方法,如下所示。
if(GoogleSafeBrowsing::isPhishing()) {
echo 'This could be a phishing site!';
}
if(GoogleSafeBrowsing::isMalware()) {
echo 'This could be a malicious software!';
}
if(GoogleSafeBrowsing::isUnwanted()) {
echo 'This could be a unwanted site!';
}
许可证
本包采用MIT许可证。
版权所有 2016 苏科惠库