Skip to content

Google Admob server-side verification php library

License

Notifications You must be signed in to change notification settings

Junker/symfony-admob-ssv

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Symfony Google AdMob Server-side Verification

The library help you to verify Admob callback in server.

Install

composer require junker/symfony-admob-ssv

How to use

use Junker\AdMobSSV\AdMobSSV;
use Symfony\Component\HttpFoundation\Request;

public function callback(Request $request) {
    $ssv = new AdMobSSV($request);
    if ($ssv->validate()) {
        // success
    } else {
        // failed
    }
}

example with public key cache

use Junker\AdMobSSV\AdMobSSV;
use Symfony\Component\HttpFoundation\Request;
use Kevinrob\GuzzleCache\Strategy\PrivateCacheStrategy;
use Kevinrob\GuzzleCache\Storage\DoctrineCacheStorage;
use Doctrine\Common\Cache\FilesystemCache;

public function callback(Request $request) {
    $ssv = new AdMobSSV($request);

    $ssv->setCacheStrategy(
        new PrivateCacheStrategy(
            new DoctrineCacheStorage(
                new FilesystemCache('/tmp/')
            )
        )
    );

    if ($ssv->validate()) {
        // success
    } else {
        // failed
    }
}

About

Google Admob server-side verification php library

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 100.0%