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

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

hlack/signed-url
================

Signed (unique) URL package for Laravel 5.6+.

2.0.x-dev(6y ago)01MITPHPPHP ^7.2

Since Jul 26Pushed 6y agoCompare

[ Source](https://github.com/hlaCk/signed-url)[ Packagist](https://packagist.org/packages/hlack/signed-url)[ RSS](/packages/hlack-signed-url/feed)WikiDiscussions 2.0 Synced 2mo ago

READMEChangelogDependencies (3)Versions (1)Used By (0)

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

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

### This package created by: [akaunting.com](http://akaunting.com) and all rights is reserved for akaunting

[](#this-package-created-by-akauntingcom-and-all-rights-is-reserved-for-akaunting)

##### Upgraded by: [hlaCk](https://github.com/hlaCk)

[](#upgraded-by-hlack)

```
Totally upgraded only for laravel `5.6+`

```

[![Version](https://camo.githubusercontent.com/3ca1eab364268c13a64e80b1ebb80dee770fc749f929cd0751417ada38a46dfd/68747470733a2f2f706f7365722e707567782e6f72672f7370696e7a61722f7369676e65642d75726c2f762f737461626c652e737667)](https://github.com/spinzar/signed-url/releases)[![StyleCI](https://camo.githubusercontent.com/e0c029c78135042c54ad27fcba5455cb427e1b166e03d15ac542418e4d75eaf1/68747470733a2f2f7374796c6563692e696f2f7265706f732f3130323239303234392f736869656c643f7374796c653d666c6174266272616e63683d6d6173746572)](https://styleci.io/repos/102290249)[![Build Status](https://camo.githubusercontent.com/89b1420d21ea99a36dfbbcc87a927e96847a98019616f6b5545f056cd14b9e29/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f7370696e7a61722f7369676e65642d75726c2f6261646765732f6275696c642e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/spinzar/signed-url/build-status/master)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/6bf54baef2d5aafab276c046b72ed45b8276305a65409713b7c0c52cb0561208/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f7370696e7a61722f7369676e65642d75726c2f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/spinzar/signed-url/?branch=master)[![Downloads](https://camo.githubusercontent.com/01811a84b87e490b6fc2ead0e03711650f6cc7e774296e4843045d337b7595c3/68747470733a2f2f706f7365722e707567782e6f72672f7370696e7a61722f7369676e65642d75726c2f642f746f74616c2e737667)](https://github.com/spinzar/signed-url)[![License](https://camo.githubusercontent.com/3b1c43801b4b42c65e385a839d69804c378f717ad7a16bc7fe40db0f4bdb541a/68747470733a2f2f706f7365722e707567782e6f72672f7370696e7a61722f7369676e65642d75726c2f6c6963656e73652e737667)](LICENSE.md)

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/spinzar/signed-url#protecting-routes-with-middleware).

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

[](#installation)

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

```
composer require spinzar/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' => [
    ...
    Spinzar\SignedUrl\Provider::class,
];

'aliases' => [
    ...
    'SignedUrl' => Spinzar\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'    => 'Spinzar\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)

- [Nassim Nasibullah](https://github.com/spinzar)

License
-------

[](#license)

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

###  Health Score

17

—

LowBetter than 6% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity1

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity37

Early-stage or recently created project

 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

Unknown

Total

1

Last Release

2485d ago

### Community

Maintainers

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

---

Top Contributors

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

---

Tags

urllaraveluniquesignedunique linkunique url

### Embed Badge

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

```
[![Health](https://phpackages.com/badges/hlack-signed-url/health.svg)](https://phpackages.com/packages/hlack-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)
