PHP code example of aschmelyun / basic-feeds

1. Go to this page and download the library: Download aschmelyun/basic-feeds library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

aschmelyun / basic-feeds example snippets


use Aschmelyun\BasicFeeds\Feed;

$feed = Feed::create([
    'link' => 'https://example.com/blog',
    'authors' => 'Andrew Schmelyun',
    'title' => 'My Example Blog',
    'feed' => 'https://example.com/feed.xml',
]);

$feed->entry([
    'title' => 'Post One',
    'link' => 'https://example.com/blog/post-one',
    'summary' => 'This is my summary',
    'content' => '<p>This is my example content!</p>'
]);

$feed->entry([
    'title' => 'Post Two',
    'link' => 'https://example.com/blog/post-two',
    'summary' => 'This is my second summary',
    'content' => '<p>This is my second example content!</p>'
], [
    'title' => 'Post Three',
    'link' => 'https://example.com/blog/post-three',
    'summary' => 'This is my third summary',
    'content' => '<p>This is my third example content!</p>'
]);

$xml = $feed->asAtom();
// $xml = $feed->asRss();