Pharaonic
Loading...

# Channel Creation

You have to create the channel but there are some required fields.

1use Pharaonic\RSS\RSS;
2 
3$feed = (new RSS())
4 ->setTitle('PAGE TITLE') // REQUIRED
5 ->setDescription('PAGE DESCRIPTION') // REQUIRED
6 ->setLink('https://pharaonic.io') // REQUIRED
7 
8 ->setImage('https://pharaonic.io/x.jpg') // OPTIONAL
9 ->setLanguage('en') // OPTIONAL
10 ->setCopyright('Copyright 2021, Pharaonic') // OPTIONAL
11 ->setPublished('Fri, 02 Oct 2020 00:00:01 +0200') // OPTIONAL
12 ->setUpdated('Tue, 15 Jun 2021 15:00:00 +0200'); // OPTIONAL

# Items Creation

You can create the item of feed but there are some required fields.

1use Pharaonic\RSS\RSSItem;
2 
3$item = (new RSSItem)
4 ->setTitle('Slugify') // REQUIRED
5 ->setDescription('Simplest Slugify for PHP to convert string into a slug') // REQUIRED
6 ->setLink('https://pharaonic.io/packages/php/slugify') // REQUIRED
7 
8 ->setGUID('https://pharaonic.io/package/1-general-php/7-hijri') // OPTIONAL
9 ->setCategory('Packages')->setCategory('PHP') // OPTIONAL
10 ->setAuthor('someone@example.com (Someone Name)') // OPTIONAL
11 ->setPublished('Tue, 25 May 2021 16:14:00 +0200'); // OPTIONAL

Append the Item to the Channel, you can use one of this 2 ways.

1// WAY 1
2$feed->setItem($item);
3 
4// WAY 2
5$item->appendToChannel($feed);

# Render

Generate the whole feed and you can use one of this 2 ways but you should display the feed with Content-Type=text/xml.

1// WAY 1
2echo $feed->render();
3 
4// WAY 2
5echo $feed;