> For the complete documentation index, see [llms.txt](https://atomframework.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://atomframework.gitbook.io/docs/basics/url-generation.md).

# URL Generation

Atom provides several helpers to assist you in generating URLs for your application. Of course, these are mainly helpful when building links in your templates and API responses, or when generating redirect responses to another part of your application.

## **Generate Basics URLs**

The `url` helper may be used to generate arbitrary URLs for your application. The generated URL will automatically use the scheme (HTTP or HTTPS) and host from the current request:

```php
$post = App\Models\Post::find(1);

echo url("/posts/{$post->id}");

// http://example.com/posts/1
```

## **URLs For Named Routes**

The `route` helper may be used to generate URLs to named routes. Named routes allow you to generate URLs without being coupled to the actual URL defined on the route. Therefore, if the route's URL changes, no changes need to be made to your route function calls. For example, imagine your application contains a route defined like the following:

```php
router()->get('/post/:post', function () {
    //
})->name('post.show');
```

To generate a URL to this route, you may use the route helper like so:

```php
echo route('post.show', ['post' => 1]);
```
