PHPackages                             saippuakauppias/safe-browsing - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. saippuakauppias/safe-browsing

ActiveLibrary[API Development](/categories/api)

saippuakauppias/safe-browsing
=============================

Client to use Google's and Yandex Safe Browsing API (v4)

1.0.0(7y ago)1020.2k↑73.3%MITPHP

Since May 17Pushed 7y ago1 watchersCompare

[ Source](https://github.com/saippuakauppias/safe-browsing)[ Packagist](https://packagist.org/packages/saippuakauppias/safe-browsing)[ RSS](/packages/saippuakauppias-safe-browsing/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (5)Versions (2)Used By (0)

Safe Browsing
=============

[](#safe-browsing)

Client to use [Google's](https://developers.google.com/safe-browsing/v4/) and [Yandex](https://tech.yandex.ru/safebrowsing/) Safe Browsing API (v4). This library is fork of the [bitecodes/safe-browsing](https://github.com/bitecodes/safe-browsing) with some improvements and updates.

Requirements
------------

[](#requirements)

1. PHP7+ (tested only on PHP7.2 and PHP7.3)
2. [guzzlehttp/guzzle](guzzlehttp/guzzle) &gt;= v6

Installation
------------

[](#installation)

The preferred way to install this library is through [composer](http://getcomposer.org/download/).

Either run

```
$ composer require saippuakauppias/safe-browsing
```

or add

```
"saippuakauppias/safe-browsing": "^1.0"

```

to the `require` section of your `composer.json` file.

Usage
-----

[](#usage)

```
require 'vendor/autoload.php';

use Saippuakauppias\SafeBrowsing\Client as SBClient;
use Http\Adapter\Guzzle6\Client as GuzzleClient;

// config for Safe Browsing request
$config = [
    'api_key'           => '0123456789', // see API Keys section
    'client_id'         => 'ShortClientName', // change to your client name
    'client_version'    => '1.0.0', // change to your client version
];

// create HTTP Client
$guzzle = new GuzzleClient();

// create Safe Browsing Client from HTTP Client and config
$sbc = new SBClient($guzzle, $config);

// if you need to check urls in Yandex Safe Browsing
// uncomment next line (and change API Key of course!):
// $sbc->setHost('sba.yandex.net');

// urls array (up to 500)
$urls_need_check = [
    // yandex safe browsing test urls
    "https://ydx-phish-shavar.cepera.ru",
    "https://ydx-malware-driveby-shavar.cepera.ru",

    // google safe browsing test urls
    // (see all in: https://testsafebrowsing.appspot.com )
    "https://testsafebrowsing.appspot.com/s/phishing.html",
    "https://testsafebrowsing.appspot.com/s/malware.html",
];

// check urls in SB (execute 'threatMatches:find' request)
$result = $sbc->lookup($urls_need_check);

// example: result as php array
var_dump($result->getContent());
// array(1) {
//   ["matches"]=>
//   array(2) {
//     [0]=>
//     array(5) {
//       ["threatType"]=>
//       string(18) "SOCIAL_ENGINEERING"
//       ["platformType"]=>
//       string(12) "ANY_PLATFORM"
//       ["threat"]=>
//       array(1) {
//         ["url"]=>
//         string(52) "https://testsafebrowsing.appspot.com/s/phishing.html"
//       }
//       ["cacheDuration"]=>
//       string(4) "300s"
//       ["threatEntryType"]=>
//       string(3) "URL"
//     }
//     [1]=>
//     array(5) {
//       ["threatType"]=>
//       string(7) "MALWARE"
//       ["platformType"]=>
//       string(12) "ANY_PLATFORM"
//       ["threat"]=>
//       array(1) {
//         ["url"]=>
//         string(51) "https://testsafebrowsing.appspot.com/s/malware.html"
//       }
//       ["cacheDuration"]=>
//       string(4) "300s"
//       ["threatEntryType"]=>
//       string(3) "URL"
//     }
//   }
// }

// example: show url valid or not one by one
foreach($urls_need_check as $test_url) {
    echo $test_url . ' is valid: ' . (int) $result->isValid($test_url)  . PHP_EOL;
}
// https://ydx-phish-shavar.cepera.ru is valid: 1
// https://ydx-malware-driveby-shavar.cepera.ru is valid: 1
// https://testsafebrowsing.appspot.com/s/phishing.html is valid: 0
// https://testsafebrowsing.appspot.com/s/malware.html is valid: 0
```

Usage Yandex Safe Browsing
--------------------------

[](#usage-yandex-safe-browsing)

To use Yandex Safe Browsing, you must change the API Key and replace the base host via the method:

```
$sbc->setHost('sba.yandex.net');
```

API Keys
--------

[](#api-keys)

Get Google API Key [here](https://console.cloud.google.com/apis/library/safebrowsing.googleapis.com).

Get Yandex API Key [here](https://developer.tech.yandex.ru/).

Misc
----

[](#misc)

[Usage limits](https://developers.google.com/safe-browsing/v4/usage-limits) for Google SafeBrowsing.

###  Health Score

33

—

LowBetter than 75% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity31

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

2558d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/24b7352fa0822b45ac1fec1c3ddc5de252af81ec37a2fcd59bdd49f46bea9154?d=identicon)[saippuakauppias](/maintainers/saippuakauppias)

---

Top Contributors

[![thmsu](https://avatars.githubusercontent.com/u/67536769?v=4)](https://github.com/thmsu "thmsu (1 commits)")

---

Tags

google-safebrowsinggsbmalwarephishingsafe-browsingsecuritythreatyandex-safebrowsingysbapisecuritydetectionmalwaregsbthreatphishingSafe BrowsingYSB

### Embed Badge

![Health badge](/badges/saippuakauppias-safe-browsing/health.svg)

```
[![Health](https://phpackages.com/badges/saippuakauppias-safe-browsing/health.svg)](https://phpackages.com/packages/saippuakauppias-safe-browsing)
```

###  Alternatives

[theodo-group/llphant

LLPhant is a library to help you build Generative AI applications.

1.5k311.5k5](/packages/theodo-group-llphant)[apigee/apigee-client-php

Client library for connecting to the Apigee Edge API.

27558.7k3](/packages/apigee-apigee-client-php)[swader/diffbot-php-client

A PHP wrapper for using Diffbot's API

5328.5k](/packages/swader-diffbot-php-client)[pay-now/paynow-php-sdk

PHP client library for accessing Paynow API

18193.9k2](/packages/pay-now-paynow-php-sdk)[dhope0000/lxd

PHP-based API wrapper for LXD REST API.

136.2k](/packages/dhope0000-lxd)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
