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

Developer654079525's avatar

Generating RSS

I am using the following code to generate the rss feed and dump it to a file. The code uses a blade template. I dump the file to the disk manually using the tinker. I am looking forward to the code review and feedback:

    public static function createrss() // create the rss feed
    {
        $posts = Post::with('postdetail')
        ->where('category', '=', 'blog') // the blog category
        ->get();// get all the blog posts
        $html = view('blog_feed', ['posts' => $posts])->render();
        Storage::disk('local')->put('rss.xml', $html); // save to file
    }

I would like to save to the public folder directly, however I am not aware if I can add a custom path to the framework.

0 likes
1 reply

Please or to participate in this conversation.