URLs For Named Routes: Signed URLs

Use Illuminate\Support\Facades\URL;

return URL::signedRoute('unsubscribe', ['user' => 1]);
Use Illuminate\Support\Facades\URL;

return URL::temporarySignedRoute(
    'unsubscribe', now()->addMinutes(30), ['user' => 1]
  • Laravel allows you to easily create "signed" URLs to named routes.
  • Have a "signature" hash appended to the query string which allows Laravel to verify that the URL has not been modified since it was created.
  • Are especially useful for routes that are publicly accessible yet need a layer of protection against URL manipulation.

Validating Signed Route Requests

Use Illuminate\Http\Request;

Route::get('/unsubscribe/{user}', function (Request $request) {
    if (! $request->hasValidSignature()) {

    // ...
 * The application's route middleware.
 * These middleware may be assigned to groups or used individually.
 * @var array
protected $routeMiddleware = [
    'signed' => \Illuminate\Routing\Middleware\ValidateSignature::class,
Route::post('/unsubscribe/{user}', function (Request $request) {
    // ...

URLs For Named Routes: Signed URLs — Structure map

Clickable & Draggable!

URLs For Named Routes: Signed URLs — Related pages: