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