

Easily subscribe to new RSS/Atom feeds by clicking the browser icon Instantaneously see when new posts are added to one of your RSS and Atom feeds Have any questions? We're always listening at best RSS Feed Reader extension for Chrome. That is pretty much it.Get a simple overview of your RSS and Atom feeds in the toolbar Keep up with everything you care about in one place with Feeder (Feeder is the news manager that tracks any online source you choose and bundles it into an easy-to-digest reading experience. You can take a look at the following link as an example: To do that, open the routes/web.php file and add the following line: Route::get( 'feed', ' ') Įssentially with that, when someone visits /feed, they will get an RSS feed response back! In case that you are not using Laravel Voyager, make sure to adjust the $post-> properties so that they match your model! Configuring your Routeįinally, we need to create a new route and map it to our RSS Controller. With that, we define our RSS feed XML structure, and inside we use a foreach loop to print out all of our tutorials.
Php rss reader tutorial update#
Note: make sure to update the and the description of your site! Then add the following content: '.PHP_EOL Then in that folder, create a file called : resources/views/rss/ Let's start by creating a folder called rss inside our resources/views/ folder: mkdir resources/views/rss With that, our Controller is ready! Next, we will configure our Blade view! Configuring your Blade view

return response()->view('rss.feed', compact('posts')): Here we return the posts result to our rss/ view.limit(50)->get() : here we limit the results to 50 only so that we don't get too many posts back.orderBy('created_at', 'desc'): We sort the posts so that we could get the newest on top.$posts = Post::where('status', 'published'): Then we define a new variable called $posts which would contain all of our published posts.public function index(): Then specify the name of the method.If you are not using Voyager, make sure to adapt this accordingly use TCG\Voyager\Models\Post : First, we include the Voyager Post model.Return response()->view( 'rss.feed', compact( 'posts'))->header( 'Content-Type', 'application/xml') This will create a new controller for you, and it will add it to the app/Http/Controllers/RssFeedController.php directory.Īfter that, using your favorite text editor, open the file and add a new method called feed for example: You can do that with the following php artisan command: php artisan make :controller RssFeedController Let's start by creating a new controller called RssFeedController. And I will expose the latest posts from my Laravel Voyager blog to my RSS feed! Checkout our latest product - the ultimate tailwindcss page creator 🚀 Configuring RSS Controller For this example, I will use my Post model that comes by default with the Laravel Voyager. You would also need a model which you would work with.
Php rss reader tutorial free#
If you are new to DigitalOcean, you can use my referral link to get a free $100 credit so that you can spin up your own servers for free:

Php rss reader tutorial how to#
If you don't have one, you can follow the steps here on how to install Laravel on DigitalOcean with 1-Click. To get started, all that you need is a Laravel application. However, in this tutorial, I will show you how to do that easily without adding a whole package! Prerequisites You can add an RSS feed to Laravel Application by using the laravel-feed. Having an RSS feed would allow your users to track the latest posts on your website easily.īut having an RSS feed will also allow you to sign up for services like or and post your latest articles there automatically. RSS stands for Really Simple Syndication and is a feed that returns information in XML format. How to add a simple RSS feed to Laravel without using a package?
