bentools/gmaps-api-sign-url

Sign Google Static Maps API Urls. No dependency.

1.0 2018-07-26 10:00 UTC

This package is auto-updated.

Last update: 2024-10-29 05:40:30 UTC


README

Latest Stable Version License Build Status Coverage Status Quality Score Total Downloads

Google Static Maps API Url Signer

Yes, it's a long name for such a simple library. When you use Google Static maps API, your key can be stolen if you don't sign your Urls.

Retrieve your secret key in your Google cloud Dashboard: APIs > Maps Static API > Url signing secret.

Installation

composer require bentools/gmaps-api-sign-url

Tests

./vendor/bin/phpunit

Usage

use BenTools\GmapsApiSigner\GmapsUrlSigner;

$secretKey = 'google_api_signing_secret';
$sign = new GmapsUrlSigner($secretKey);
<html>
<body>
<script src="<?=$sign('https://maps.googleapis.com/maps/api/js?key=api_key')?>"></script>
</body>
</html>