PHP implementation of gcloud compute sign-url
based on Google Cloud CDN Documentation.
The provided file includes implementation of base64url encode and decode functions based on RFC4648 Section 5.
require_once 'signUrl.php';
$base64url_key = 'wpLL7f4VB9RNe_WI0BBGmA=='; // head -c 16 /dev/urandom | base64 | tr +/ -_
$signed_url = signUrl('https://example.com/foo', 'my-key', $base64url_key, time() + 1800);
echo $signed_url;