Skip to content

Commit

Permalink
Add example.
Browse files Browse the repository at this point in the history
  • Loading branch information
ddebin committed Sep 13, 2019
1 parent fad4012 commit 8182ce0
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions example/feed.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php

include_once 'vendor/autoload.php';

$entry = new AtomGenerator\Entry();
$entry->setTitle('Post', 'text');
$entry->setId('tag:id');
$entry->setContent('Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.', 'text');
$entry->setUpdatedDateTime(new DateTime('2019-05-04T21:00:40Z'));

$feed = new AtomGenerator\Feed();
$feed->setTitle('Blog');
$feed->setUpdatedDateTime(new DateTime('now'));
$feed->addEntry($entry);

assert(AtomGenerator\Feed::validate($feed->getDocument()));

echo $feed->saveXML();

0 comments on commit 8182ce0

Please sign in to comment.