xsist10 / safebrowser
This package is abandoned and no longer maintained.
No replacement package was suggested.
Client for the Google Safe Browser API
v1.0.1
2014-04-07 12:49 UTC
Requires (Dev)
- phpmd/phpmd: 1.4.*
- phpunit/phpunit: 4.0.*@dev
- sebastian/phpcpd: 2.0.x-dev
- squizlabs/php_codesniffer: dev-master
This package is auto-updated.
Last update: 2023-11-18 17:55:07 UTC
README
Demo code for PHPSA14 (http://phpsouthafrica.com/) conference
Get an API key
Installing
This library is available via Composer:
{
"require": {
"xsist10/safebrowser": "v1.0.0"
}
}
Using
<?php require 'vendor/autoload.php'; use xsist10\SafeBrowsing\SafeBrowsing; use xsist10\SafeBrowsing\Strategy\Chain; use xsist10\SafeBrowsing\Strategy\Post; use xsist10\SafeBrowsing\Strategy\Get; $chain = new Chain(); $chain->append(new Post()); $chain->append(new Get()); $safeBrowsing = new SafeBrowsing("[API KEY]", $chain); $response = $safeBrowsing->isUrlSafe('http://ianfette.org/'); if (!$response->isSecure()) { // Oh no! Panic! if ($response->hasMalware()) { // Malware detected } if ($response->hasPhishing()) { // Phising detected } }