Breaking News
You are here : Home / Web development / PHP / All in one PHP Feed Writer Class
Php Feed writer

All in one PHP Feed Writer Class

All in One php feed writer class is used to generate feeds for your website.this Feed Writer is capable of creating RSS 1.0, RSS2.0 and ATOM feeds statically as well as dynamically.For dynamic feed generation we also requires a database class ,which of-course i have included.The Usage of this All in one feed writer or aio feed writer class is very easy.

So firstly we need to take a look at what is the basic formats of the feeds:atom,rss1 and rss2


[separator /]
So now You have gone through all the major Feed each type has all the different type of tags or somewhat simillar.So this feed writer class will cover above three feed formats.
so now we take a look at Feed Writer class.this class extends the feeditem we’ll create a instace of the feed Writer class and all done.I have use inheritance to maintain the heirarchy for the tags and make it easy to understand.


Awh! this feed writer code looks huge.but you don’t have to worry about it.for using it you don’t have to edit it.Editing is not necessary.If you have a gud hold on your OOPS concepts edit it if you like.but for now this class is ready for use.You don’t need to worry about code if you don’t understand ,you just need to include it.and i’ll show how to implement various kind of feeds.

just copy the code and create a file aiofeedwriter.php. or you can download the source with examples .download link is at the bottom of the post.
[separator /]


using the feed writer class is very easy . whether you need atom or rss output.The very first step is common for all kind of feeds.So the common step is to include class in out php page

so now that we have included the file now we see all there type of feed codes.and after that we’ll take a look at dynamic feed generation from your database table.

So firsty lets take a look at atom,rss1 and rss2 code.some are the special tags for these formats and they must be used,and some can be skipper as the requirements or you can set more channel or item elements according to your needs.



For the dynamic generation of the feed you should need a database connection.In the source i have included the database class .

here are the steps how to generate feeds dynamically.

Firstly Edit the file with the connection data e.g:host,database password,database is the global file

Then Include the Database class and the global variable class in the php page where the feeds are going to be generated.some beginners might think about the why xml feed on php page.actaully php will render teh output as xml.php generally supports many formats.we just have to tell it in header function which kind of output is required.

Include database class and Global file

You dont need to worry about the code inside the mysql.class.php . this file contains a class which connects to database.

see below the full code in the php script where you need to generate your feed dynamically.

in same fashion you can generate Rss1 and Atom feeds dynamically.the only difference is some tags and channel elements according to the format.

That was all for the All in One feed writer class.I have just included only one example of RSS2 Feed for dynamic feed can also do same for ATOM and RSS1.that is pretty easy.

For your easiness i have included the full source below link to download


I hope you guys enjoyed the post.please share,like and voteup if you liked this.Thanks

Tags : , , , ,

3 Replies

  1. Thanks a bunch for sharing this with all people you actually recognize what you are talking about! Bookmarked. Please also consult with my web site =). We could have a hyperlink change agreement between us

  2. Lee Travis says:

    Can I simply say what a aid to find somebody who really knows what theyre speaking about on the internet. You positively know learn how to carry a difficulty to gentle and make it important. More people need to read this and perceive this facet of the story. I cant believe youre not more well-liked because you undoubtedly have the gift.

  3. Nice post. I was checking continuously this blog and I’m impressed! Extremely useful information specially the final section 🙂 I deal with such info much. I was looking for this particular information for a very lengthy time. Thank you and best of luck.

Leave a Reply

Want to join the discussion ? Feel Free to contribute !