README.md
1UniversalFeedCreator
2====================
3
4RSS and Atom feed generator by Kai Blankenhorn, slightly cleaned up and packaged for Composer.
5
6Supported formats: RSS0.91, RSS1.0, RSS2.0, PIE0.1 (deprecated), MBOX, OPML, ATOM, ATOM0.3,
7HTML, JS, PHP
8
9## General Usage
10
11```php
12require 'vendor/autoload.php';
13
14$rss = new UniversalFeedCreator();
15$rss->useCached(); // use cached version if age < 1 hour
16$rss->title = "PHP news";
17$rss->description = "daily news from the PHP scripting world";
18
19//optional
20$rss->descriptionTruncSize = 500;
21$rss->descriptionHtmlSyndicated = true;
22
23$rss->link = "http://www.dailyphp.net/news";
24$rss->syndicationURL = "http://www.dailyphp.net/" . $_SERVER["SCRIPT_NAME"];
25
26$image = new FeedImage();
27$image->title = "dailyphp.net logo";
28$image->url = "http://www.dailyphp.net/images/logo.gif";
29$image->link = "http://www.dailyphp.net";
30$image->description = "Feed provided by dailyphp.net. Click to visit.";
31
32//optional
33$image->descriptionTruncSize = 500;
34$image->descriptionHtmlSyndicated = true;
35
36$rss->image = $image;
37
38// get your news items from somewhere, e.g. your database:
39mysql_select_db($dbHost, $dbUser, $dbPass);
40$res = mysql_query("SELECT * FROM news ORDER BY newsdate DESC");
41while ($data = mysql_fetch_object($res)) {
42 $item = new FeedItem();
43 $item->title = $data->title;
44 $item->link = $data->url;
45 $item->description = $data->short;
46
47 //optional
48 $item->descriptionTruncSize = 500;
49 $item->descriptionHtmlSyndicated = true;
50
51 $item->date = $data->newsdate;
52 $item->source = "http://www.dailyphp.net";
53 $item->author = "John Doe";
54
55 $rss->addItem($item);
56}
57
58echo $rss->saveFeed("RSS1.0", "news/feed.xml");
59```
60
61## Changelog:
62
63```
64v1.8 12-03-13
65 packaged for Composer & cleaned up slightly
66
67v1.7.7(BH) 28-03-06
68 added GPX Feed (Barry Hunter)
69
70
71v1.7.6(BH) 20-02-06
72 added GeoRSS Feed (Barry Hunter)
73
74
75v1.7.5(BH) 16-11-05
76 added BASE Feed (Barry Hunter)
77
78v1.7.4(BH) 05-07-05
79 added KML Feed (Barry Hunter)
80
81v1.7.3(BH) 05-07-05
82 added PHP Feed (Barry Hunter)
83
84v1.7.2 10-11-04
85 license changed to LGPL
86
87v1.7.1
88 fixed a syntax bug
89 fixed left over debug code
90
91v1.7 07-18-04
92 added HTML and JavaScript feeds (configurable via CSS) (thanks to Pascal Van Hecke)
93 added HTML descriptions for all feed formats (thanks to Pascal Van Hecke)
94 added a switch to select an external stylesheet (thanks to Pascal Van Hecke)
95 changed default content-type to application/xml
96 added character encoding setting
97 fixed numerous smaller bugs (thanks to Sören Fuhrmann of golem.de)
98 improved changing ATOM versions handling (thanks to August Trometer)
99 improved the UniversalFeedCreator's useCached method (thanks to Sören Fuhrmann of golem.de)
100 added charset output in HTTP headers (thanks to Sören Fuhrmann of golem.de)
101 added Slashdot namespace to RSS 1.0 (thanks to Sören Fuhrmann of golem.de)
102
103v1.6 05-10-04
104 added stylesheet to RSS 1.0 feeds
105 fixed generator comment (thanks Kevin L. Papendick and Tanguy Pruvot)
106 fixed RFC822 date bug (thanks Tanguy Pruvot)
107 added TimeZone customization for RFC8601 (thanks Tanguy Pruvot)
108 fixed Content-type could be empty (thanks Tanguy Pruvot)
109 fixed author/creator in RSS1.0 (thanks Tanguy Pruvot)
110
111v1.6 beta 02-28-04
112 added Atom 0.3 support (not all features, though)
113 improved OPML 1.0 support (hopefully - added more elements)
114 added support for arbitrary additional elements (use with caution)
115 code beautification :-)
116 considered beta due to some internal changes
117
118v1.5.1 01-27-04
119 fixed some RSS 1.0 glitches (thanks to Stéphane Vanpoperynghe)
120 fixed some inconsistencies between documentation and code (thanks to Timothy Martin)
121
122v1.5 01-06-04
123 added support for OPML 1.0
124 added more documentation
125
126v1.4 11-11-03
127 optional feed saving and caching
128 improved documentation
129 minor improvements
130
131v1.3 10-02-03
132 renamed to FeedCreator, as it not only creates RSS anymore
133 added support for mbox
134 tentative support for echo/necho/atom/pie/???
135
136v1.2 07-20-03
137 intelligent auto-truncating of RSS 0.91 attributes
138 don't create some attributes when they're not set
139 documentation improved
140 fixed a real and a possible bug with date conversions
141 code cleanup
142
143v1.1 06-29-03
144 added images to feeds
145 now includes most RSS 0.91 attributes
146 added RSS 2.0 feeds
147
148v1.0 06-24-03
149 initial release
150```
151
152## Credits
153```
154originally (c) Kai Blankenhorn
155www.bitfolge.de
156kaib@bitfolge.de
157v1.3 work by Scott Reynen (scott@randomchaos.com) and Kai Blankenhorn
158v1.5 OPML support by Dirk Clemens
159```
160