PHP code example of psx / atom

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

    

psx / atom example snippets


$person = new Person();
$person->setName('foobar');
$person->setUri('http://foo.com');
$person->setEmail('[email protected]');

$text = new Text();
$text->setContent('foobar');

$entry = new Entry();
$entry->setAuthor([$person]);
$entry->setContent($text);
$entry->setId('http://localhost.com#1');
$entry->setTitle('Star City');
$entry->setPublished(LocalDateTime::from(new \DateTime('Tue, 10 Jun 2003 04:00:00 GMT')));

$atom = new Atom();
$atom->setId('http://localhost.com');
$atom->setTitle('Foo has bar');
$atom->setUpdated(LocalDateTime::from(new \DateTime('Tue, 10 Jun 2003 04:00:00 GMT')));
$atom->setEntry([$entry]);

echo json_encode($asyncAPI, JSON_PRETTY_PRINT);