PHPackages                             patieru/signed-url - 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. patieru/signed-url

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

patieru/signed-url
==================

Signed (unique) URL package for Laravel.

1.0.4(6y ago)017MITPHPPHP &gt;=7.2

Since Sep 26Pushed 6y ago1 watchersCompare

[ Source](https://github.com/patieru12/signed-url)[ Packagist](https://packagist.org/packages/patieru/signed-url)[ RSS](/packages/patieru-signed-url/feed)WikiDiscussions master Synced yesterday

READMEChangelog (5)Dependencies (3)Versions (6)Used By (0)

Signed (unique) URL package for Laravel.
========================================

[](#signed-unique-url-package-for-laravel)

This package can create URLs with a limited lifetime. This is done by adding an expiration date and a signature to the URL.

This is how you can create signed URL that's valid for 30 days:

```
SignedUrl::sign('https://myapp.com/protected-route', 30);
```

The output will look like this:

```
https://app.com/protected-route?expires=xxxxxx&signature=xxxxxx

```

The URL can be validated with the `validate`-function.

```
SignedUrl::validate('https://app.com/protected-route?expires=xxxxxx&signature=xxxxxx');
```

The package also provides [a middleware to protect routes](https://github.com/patieru12/signed-url#protecting-routes-with-middleware).

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

[](#installation)

As you would have guessed the package can be installed via Composer:

```
composer require patieru/signed-url

```

This package intends to provide tools for formatting and conversion monetary values in an easy, yet powerful way for Laravel projects. In older versions of the framework, just add the serviceprovider, and optionally register the facade:

```
// config/app.php

'providers' => [
    ...
    Patieru\SignedUrl\Provider::class,
];

'aliases' => [
    ...
    'SignedUrl' => Patieru\SignedUrl\Facade::class,
];
```

Configuration
-------------

[](#configuration)

The configuration file can optionally be published via:

```
php artisan vendor:publish --provider=signed-url

```

This is the content of the file:

```
return [

    /*
    * This string is used the to generate a signature. You should
    * keep this value secret.
    */
    'signatureKey' => env('APP_KEY'),

    /*
     * The default expiration time of a URL in days.
     */
    'default_expiration_time_in_days' => 1,

    /*
     * These strings are used a parameter names in a signed url.
     */
    'parameters' => [
        'expires' => 'expires',
        'signature' => 'signature',
    ],

    /*
    |--------------------------------------------------------------------------
    | Middleware
    |--------------------------------------------------------------------------
    |
    | This option indicates the middleware to change language.
    |
    */
    'middleware'    => 'Patieru\SignedUrl\Middleware\ValidateSignedUrl',

];
```

Usage
-----

[](#usage)

### Signing URLs

[](#signing-urls)

URL's can be signed with the `sign`-method:

```
SignedUrl::sign('https://myapp.com/protected-route');
```

By default the lifetime of an URL is one day. This value can be change in the config-file. If you want a custom life time, you can specify the number of days the URL should be valid:

```
//the generated URL will be valid for 5 days.
SignedUrl::sign('https://myapp.com/protected-route', 5);
```

For fine grained control, you may also pass a `DateTime` instance as the second parameter. The url will be valid up to that moment. This example uses Carbon for convenience:

```
//This URL will be valid up until 2 hours from the moment it was generated.
SignedUrl::sign('https://myapp.com/protected-route', Carbon\Carbon::now()->addHours(2) );
```

### Validating URLs

[](#validating-urls)

To validate a signed URL, simply call the `validate()`-method. This return a boolean.

```
SignedUrl::validate('https://app.com/protected-route?expires=xxxxxx&signature=xxxxxx');
```

### Protecting routes with middleware

[](#protecting-routes-with-middleware)

The package also provides a middleware to protect routes:

```
Route::get('protected-route', ['middleware' => 'signed', function () {
    return 'Hello secret world!';
}]);
```

Your app will abort with a 403 status code if the route is called without a valid signature.

Changelog
---------

[](#changelog)

Please see [Releases](../../releases) for more information what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Security
--------

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Cüneyt Şentürk](https://github.com/cuneytsenturk)
- [Sebastian De Deyne](https://github.com/sebastiandedeyne)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [LICENSE](LICENSE.md) for more information.

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity57

Maturing project, gaining track record

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

Total

5

Last Release

2414d ago

PHP version history (2 changes)v1.0.0PHP &gt;=5.6.0

1.0.1PHP &gt;=7.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/04142ccc3d4dc077b1d86cacd0337eccf70e282b5fbea2fe0ef68101c7a01018?d=identicon)[patieru12](/maintainers/patieru12)

---

Top Contributors

[![patieru12](https://avatars.githubusercontent.com/u/29778225?v=4)](https://github.com/patieru12 "patieru12 (6 commits)")

---

Tags

urllaraveluniquesignedunique linkunique url

### Embed Badge

![Health badge](/badges/patieru-signed-url/health.svg)

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

###  Alternatives

[yajra/laravel-datatables-oracle

jQuery DataTables API for Laravel

4.9k33.8M339](/packages/yajra-laravel-datatables-oracle)[watson/active

Laravel helper for recognising the current route, controller and action

3253.6M14](/packages/watson-active)[laragear/preload

Effortlessly make a Preload script for your Laravel application.

119363.5k](/packages/laragear-preload)[glhd/conveyor-belt

14797.0k](/packages/glhd-conveyor-belt)[dragon-code/pretty-routes

Pretty Routes for Laravel

10058.7k4](/packages/dragon-code-pretty-routes)[erlandmuchasaj/laravel-gzip

Gzip your responses.

40129.3k2](/packages/erlandmuchasaj-laravel-gzip)

PHPackages © 2026

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