Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

bufferoverflow's avatar

Are changes to URL facade persisting between requests?

For example, lets say I'm generating signed URL's for a tenant application and I want to change the base URL used in the URL facade:

// update base url
URL::formatHostUsing(function () {
  	return 'https://google.com';  
});

// generate a signed used the new domain
URL::temporarySignedRoute(
    'subscribe', now()->addMinutes(30), ['user' => 1]
);

// is this reset needed? Or is it just persisted until the end of this request? Can other users performing a request at the same moment, generate url's using the wrong domain?
URL::formatHostUsing(function () {
  	return config('app.url');  
});

Thanks!

0 likes
0 replies

Please or to participate in this conversation.