2017 © Pedro Peláez
 

library safebrowsing

Laravel package to allow you to easily integrate the Google Safebrowing API into your application.

image

snipe/safebrowsing

Laravel package to allow you to easily integrate the Google Safebrowing API into your application.

  • Sunday, February 4, 2018
  • by snipe
  • Repository
  • 1 Watchers
  • 4 Stars
  • 497 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 5 Forks
  • 1 Open issues
  • 2 Versions
  • 17 % Grown

The README.md

Safebrowsing

Gitter Build Status Latest Stable Version Total Downloads Latest Unstable Version License Codacy Badge, (*1)

This is a Laravel 5 package to enable you to easily interface with the Google Safebrowsing API. (Other RBL services are coming.), (*2)

Right now it's only using the Google Safebrowsing Lookup API (v4), but I'll be updating it to include the Update API as well. The old Safebrowsing v3 (non-package) version of this script has also included Phishtank and several RBLs, but I think the RBLs have changed how they work so that old code doesn't work anymore., (*3)

This package requires that you have an active Google Safebrowsing API key. It absolutely will not work without one. It's free to create an API key (although the process is every bit as confusing and convoluted as you would expect from Google)., (*4)

Bear in mind that Google does throttle API usage, so if you have a high-traffic site, you may want to build in a caching layer or something so you don't burn through your requests too quickly. You can keep an eye on your usage through the Google API console., (*5)

This package is very rough around the edges and probably shouldn't be used for production yet., (*6)

Install

Via Composer

``` bash $ composer require snipe/safebrowsing, (*7)


### Update Your Config #### For applications using Laravel =< 5.4 Open `config/app.php` and add: ``` php Snipe\Safebrowsing\SafebrowsingServiceProvider::class,

to your providers array in config/app.php, and:, (*8)

``` php 'Safebrowsing' => Snipe\Safebrowsing\Facade\Safebrowsing::class,, (*9)


to your `aliases` array in `config/app.php`. ### Publish the config ``` bash php artisan vendor:publish

Set Your Google Safebrowsing API Key

In your .env, add:, (*10)

``` bash GOOGLE_API_KEY=YOUR-ACTUAL-API-KEY, (*11)


There are additional options in the config file that relate to what specific types of threats you want to check for, and what platforms you want to check on, but you only really need to worry about that if you want to check *fewer* things, as it's pretty inclusive already. ## Usage ### Using Blade Syntax ``` php {{ Safebrowsing::checkSafeBrowsing($urls) }}

or, (*12)

``` php @if (Safebrowsing::isFlagged('http://twitter.com/')) // do something if the url is flagged as suspicious @else // hooray - it's not flagged! @endif, (*13)




where `$url` is an array of URLs that you would like to check against the Google Safebrowsing API. ### Using Facades ``` php Safebrowsing::addCheckUrls(['http://ianfette.org']); Safebrowsing::addCheckUrls(['http://malware.testing.google.test/testing/malware/']); Safebrowsing::execute(); print('Status of the third URL is: '.Safebrowsing::isFlagged('http://twitter.com/'));

Test URLs

Here are some handy test urls you can use while you're experimenting with the system., (*14)

  • http://www.yahoo.com/ (OK)
  • http://www.google.com/ (OK)
  • http://malware.testing.google.test/testing/malware/ (Malware)
  • http://twitter.com/ (OK)
  • http://ianfette.org (malware)
  • https://github.com/ (OK)

Change log

Please see CHANGELOG for more information what has changed recently., (*15)

Testing

From the package, (*16)

bash `../../../vendor/bin/phpunit`, (*17)

Contributing

Please see CONTRIBUTING and CONDUCT for details., (*18)

Security

If you discover any security related issues, please email snipe@snipe.net instead of using the issue tracker., (*19)

Credits

License

GNU GENERAL PUBLIC LICENSE. Please see License File for more information., (*20)

The Versions

04/02 2018

dev-master

9999999-dev https://github.com/Snipe/Safebrowsing

Laravel package to allow you to easily integrate the Google Safebrowing API into your application.

  Sources   Download

GPL-3.0

The Requires

 

The Development Requires

url google rbl malware safebrowsing snipe

30/06 2016

0.1.0

0.1.0.0 https://github.com/Snipe/Safebrowsing

Laravel package to allow you to easily integrate the Google Safebrowing API into your application.

  Sources   Download

GPL

The Requires

 

The Development Requires

url google rbl malware safebrowsing snipe