PHP code example of snicco / signed-url-psr15-bridge

1. Go to this page and download the library: Download snicco/signed-url-psr15-bridge library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

snicco / signed-url-psr15-bridge example snippets


$storage = /* */
$hmac = /* */

$validator = new \Snicco\Component\SignedUrl\SignedUrlValidator($storage, $hmac);

$middleware = new \Snicco\Bridge\SignedUrlPsr15\ValidateSignature(
    $validator,
);
/* Attach $middleware to your route */

// Same as above.
$validator = /* */
$middleware = new \Snicco\Bridge\SignedUrlPsr15\ValidateSignature(
    $validator,
    function(\Psr\Http\Message\RequestInterface $request) {
        return $request->getHeaderLine('User-Agent');
    }
);

/* Attach $middleware to your route */

// same as above
$storage = /* */
$psr3_logger = /* */

// value between 0-100
// the percentage that one request through the middleware
// will trigger garbage collection.
$percentage = 4;

$middleware = new \Snicco\Bridge\SignedUrlPsr15\CollectGarbage($percentage, $storage, $logger);

/* Attach $middleware to your route */