PHP code example of ddebin / atom-generator

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

    

ddebin / atom-generator example snippets




y = 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();