PHPackages                             snicco/signed-url-psr15-bridge - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. snicco/signed-url-psr15-bridge

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

snicco/signed-url-psr15-bridge
==============================

Psr15 middleware integration for snicco/signed-url.

v1.10.1(1y ago)015LGPL-3.0-onlyPHPPHP ^7.4|^8.0

Since Apr 17Pushed 1y ago1 watchersCompare

[ Source](https://github.com/snicco/signed-url-psr15-bridge)[ Packagist](https://packagist.org/packages/snicco/signed-url-psr15-bridge)[ RSS](/packages/snicco-signed-url-psr15-bridge/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (7)Versions (35)Used By (0)

A PSR-15 middleware for the [snicco/signed-url](https://github.com/snicco/signed-url) library
=============================================================================================

[](#a-psr-15-middleware-for-the-sniccosigned-url-library)

[![codecov](https://camo.githubusercontent.com/a99e6ec528fffd1664e95534f9a09a4a09d2afe62799ff0d8774dc22d8453f6c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f436f7665726167652d3130302532352d73756363657373)](https://app.codecov.io/gh/snicco/snicco)[![Psalm Type-Coverage](https://camo.githubusercontent.com/c12cfed65c7da16501f7a84e7861b8c4757fc30e9dc00bb2983783dbb3f3f84c/68747470733a2f2f73686570686572642e6465762f6769746875622f736e6963636f2f736e6963636f2f636f7665726167652e7376673f)](https://shepherd.dev/github/snicco/snicco)[![Psalm level](https://camo.githubusercontent.com/c5e90ffcf3a5aa1f78f93bddde5db7627b114329393aa87697df8cedc7f5391a/68747470733a2f2f73686570686572642e6465762f6769746875622f736e6963636f2f736e6963636f2f6c6576656c2e7376673f)](https://psalm.dev/)[![PhpMetrics - Static Analysis](https://camo.githubusercontent.com/364ffb28ea219affd0fed2e99cc046bac0bf41da3f1d3814e0cbe4a4bb54c994/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5068704d6574726963732d5374617469635f416e616c797369732d326561343466)](https://snicco.github.io/snicco/phpmetrics/SignedUrlPsr15Bridge/index.html)

This package consists of two simple middlewares that will make working with `snicco/signed-url` a breeze. Make sure to read the general [documentation](https://github.com/snicco/signed-url) to know how to instantiate the needed collaborators.

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

[](#installation)

```
composer require snicco/signed-url-psr15-bridge
```

Usage
-----

[](#usage)

Make sure that your favorite framework supports binding middleware on the route level. This middleware should only be added to a route where you expect signed urls, **not globally.**

### Basic Usage

[](#basic-usage)

---

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

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

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

### Customizing the additional request context.

[](#customizing-the-additional-request-context)

---

As a second argument you can pass a closure that will receive the current request. Anything you return from this closure will be taken into account when validating the current request.

**This has to match the request context that you used when the link was created!**
Using the ip-address at creation and the user-agent at validation will not work and the request will always be invalidated.

```
// 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 */
```

### Only validate unsafe HTTP methods

[](#only-validate-unsafe-http-methods)

---

If a signed-url should be used exactly one time (for `GET` requests) you might run into trouble with certain email clients that preload all links. In this case you can set the third argument of the middleware to `(bool) true`. The signature will then only be checked if the request method is one of `[POST, PATCH, PUT, DELETE]`. **Make sure you route is not accessible with safe request methods if you use this option.**

### Garbage collection

[](#garbage-collection)

---

Add the `CollectGarbage` middleware to your global middleware groups.

```
// 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 */
```

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance35

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity65

Established project with proven stability

 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 ~27 days

Recently: every ~1 days

Total

33

Last Release

612d ago

Major Versions

v1.10.0 → v2.0.0-beta.12024-09-01

v1.10.1 → v2.0.0-beta.72024-09-04

### Community

Maintainers

![](https://www.gravatar.com/avatar/d659a021c9077ceb60e6ab1ea4287b9f209edb97e93bceceb7fb539d8302e894?d=identicon)[calvinalkan](/maintainers/calvinalkan)

---

Top Contributors

[![snicco-bot](https://avatars.githubusercontent.com/u/101470239?v=4)](https://github.com/snicco-bot "snicco-bot (25 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/snicco-signed-url-psr15-bridge/health.svg)

```
[![Health](https://phpackages.com/badges/snicco-signed-url-psr15-bridge/health.svg)](https://phpackages.com/packages/snicco-signed-url-psr15-bridge)
```

###  Alternatives

[cakephp/cakephp

The CakePHP framework

8.8k18.5M1.6k](/packages/cakephp-cakephp)[jaxon-php/jaxon-core

Jaxon is an open source PHP library for easily creating Ajax web applications

73142.3k25](/packages/jaxon-php-jaxon-core)[neos/flow

Flow Application Framework

862.0M451](/packages/neos-flow)[flarum/core

Delightfully simple forum software.

211.3M1.9k](/packages/flarum-core)[neos/flow-development-collection

Flow packages in a joined repository for pull requests.

144179.3k3](/packages/neos-flow-development-collection)[windwalker/framework

The next generation PHP framework.

25639.1k1](/packages/windwalker-framework)

PHPackages © 2026

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