PHPackages                             qdenka/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. qdenka/safe-browsing

ActiveLibrary[API Development](/categories/api)

qdenka/safe-browsing
====================

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

1.1(5y ago)12.4k↓50%1MITPHP

Since Feb 5Pushed 5y ago1 watchersCompare

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

READMEChangelog (3)Dependencies (5)Versions (3)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+ / PHP8
2. [guzzlehttp/guzzle](guzzlehttp/guzzle) &gt;= v7

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

[](#installation)

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

Either run

```
$ composer require qdenka/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\Guzzle7\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

29

—

LowBetter than 59% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity21

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity54

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

Every ~38 days

Total

2

Last Release

1889d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/3339fb58d7742b5f4ce6a647b09c74739d28b9ecfc85ffb5de6d2f04b6985b82?d=identicon)[qdenka](/maintainers/qdenka)

---

Top Contributors

[![QDenka](https://avatars.githubusercontent.com/u/77678360?v=4)](https://github.com/QDenka "QDenka (6 commits)")

---

Tags

apisecuritydetectionmalwaregsbthreatphishingSafe BrowsingYSB

### Embed Badge

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

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

###  Alternatives

[saippuakauppias/safe-browsing

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

1020.2k](/packages/saippuakauppias-safe-browsing)[theodo-group/llphant

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

1.5k311.5k5](/packages/theodo-group-llphant)[jolicode/slack-php-api

An up to date PHP client for Slack's API

2534.4M12](/packages/jolicode-slack-php-api)[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)

PHPackages © 2026

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