Laravel provides the features and structure for generating your application's URLs straight out of the box. This works well as long as we're generating URLs within our application.

In this short post, I'll explain how you can use the internal Laravel's route feature set to generate your external URLs.

We'll define our new routes in a standard Laravel routes file, register them with a new RouteServiceProvider and generate URLs with the route() helper function.

Since we're generating external routes, make sure those domains aren't bound to your current application.
Newsletter

Get the latest Laravel/PHP jobs, events and curated articles straight to your inbox, once a week

Glimpse streamlines Laravel development by seamlessly deploying GitHub pull requests to preview environments with the help of Laravel Forge. Glimpse streamlines Laravel development by seamlessly deploying GitHub pull requests to preview environments with the help of Laravel Forge.
Fathom Analytics | Fast, simple and privacy-focused website analytics. Fathom Analytics | Fast, simple and privacy-focused website analytics.
Shirts painstakingly handcrafted by under-caffeinated developers. Shirts painstakingly handcrafted by under-caffeinated developers.
Community Partners