HTTP integration | laravel-feed-go | Spatie       

 SPATIE  

laravel-feed-go
===============

spatie.be/open-source

  [Docs](https://spatie.be/docs)  [Laravel-feed-go](https://spatie.be/docs/laravel-feed-go/v1)  HTTP integration

 Version   v1      

 Other versions for crawler [v1](https://spatie.be/docs/laravel-feed-go/v1) 

  HTTP integration    
- [ Introduction ](https://spatie.be/docs/laravel-feed-go/v1/introduction)
- [ Installation and setup ](https://spatie.be/docs/laravel-feed-go/v1/installation-and-setup)
- [ Usage ](https://spatie.be/docs/laravel-feed-go/v1/usage)
- [ HTTP integration ](https://spatie.be/docs/laravel-feed-go/v1/http)
- [ Customization ](https://spatie.be/docs/laravel-feed-go/v1/customization)
- [ Testing ](https://spatie.be/docs/laravel-feed-go/v1/testing)
- [ Releasing ](https://spatie.be/docs/laravel-feed-go/v1/releasing)
- [ Changelog ](https://spatie.be/docs/laravel-feed-go/v1/changelog)
- [ Support us ](https://spatie.be/docs/laravel-feed-go/v1/support-us)

 HTTP integration
================

The package registers each configured feed in Laravel's web middleware group. `Definition.Name` produces a route named `feeds.<name>`, and `Definition.Path` is joined with `Config.Prefix`. Set `FEED_PREFIX` for an environment default or override it in the configuration callback.

The loader runs for every GET or HEAD request and receives the request's context. It returns `[]feed.Item` and an error. Entries are not shared or cached between requests. Select published items, apply filters, choose ordering and limit results in your loader.

Loader errors go through `web.Fail` unchanged. Validation and rendering failures become HTTP errors rather than empty successful feeds. Missing routes return 404, and unsupported methods follow Laravel's normal routing behavior.

Leave `Feed.URL` empty to use the request's absolute path without query parameters. Set it explicitly for a fixed canonical URL. Discovery links use the named route when the URL is unset. Set `APP_URL` correctly for URL generation outside HTTP requests.

For route-specific middleware or request parameters, register a normal application handler instead:

```
func Show(r *web.Request) *web.Response {
    items, err := getFeedItems(r)
    if err != nil {
        return web.Fail(err)
    }
    return (feed.Feed{
        Title: "News",
        URL: urls.To(r, "/feed"),
        Format: feed.RSS,
        Items: items,
    }).Response(r)
}
```

Import `go.laravel.com/web`, `go.laravel.com/urls` and `github.com/spatie/laravel-feed-go`. Your application provides `getFeedItems`. Add caching, authorization or other route middleware using Laravel's native router.

 A good
match?
-------------

### What we do best

- All things Laravel
- Custom frontend components
- Building APIs
- AI-powered features
- Simplifying things
- Clean solutions
- Integrating services

### Not our cup of tea

- WordPress themes
- Cutting corners
- Free mockups to win a job
- "Just execute the briefing"

 In short: we'd like to be a **substantial part** of your project.

 [ Get in touch via email ](mailto:info@spatie.be?subject=A%20good%20match%21&body=Tell%20us%20as%20much%20as%20you%20can%20about%0A-%20your%20online%20project%0A-%20your%20planning%0A-%20your%20budget%0A-%20%E2%80%A6%0A%0AAnything%20that%20helps%20us%20to%20start%20straightforward%21)
