PHP code example of simplon / feed

1. Go to this page and download the library: Download simplon/feed 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/ */

    

simplon / feed example snippets


use Simplon\Feed\FeedReader;

$feed = new FeedReader();

// lets fetch all feed details and its items
$feedVo = $feed->rss('http://feeds.feedburner.com/techcrunch/europe?format=xml');

// e.g. reading title
var_dump($feedVo->getTitle());

// access possible namespaces
var_dump($feedVo->getNamespaces());

// access possible meta data
var_dump($feedVo->getMetas());

// access all items
foreach($feedVo->getItems() as $item)
{
    // e.g. reading title
    var_dump($item->getTitle());
    
    // access possible namespaces
    var_dump($item->getNamespaces());
    
    // access possible meta data
    var_dump($item->getMetas());
}

use Simplon\Feed\FeedReader;

$feed = new FeedReader();

// lets fetch all feed details and its items
$feedVo = $feed->atom('http://vvv.tobiassjosten.net/feed.atom');

// e.g. reading title
var_dump($feedVo->getTitle());

// access possible namespaces
var_dump($feedVo->getNamespaces());

// access possible meta data
var_dump($feedVo->getMetas());

// access all items
foreach($feedVo->getItems() as $item)
{
    // e.g. reading title
    var_dump($item->getTitle());
    
    // access possible namespaces
    var_dump($item->getNamespaces());
    
    // access possible meta data
    var_dump($item->getMetas());
}