Coder Social home page Coder Social logo

php-atom's Introduction

PHP Atom

Me fooling around with the Atom specification...

From RFC 4287:

Atom is an XML-based document format that describes lists of related information known as "feeds". Feeds are composed of a number of items, known as "entries", each with an extensible set of attached metadata. For example, each entry has a title.

The primary use case that Atom addresses is the syndication of Web content such as weblogs and news headlines to Web sites as well as directly to user agents.

Atom example documents, also from RFC 4287:

<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">

    <title>Example Feed</title>
    <link href="http://example.org/"/>
    <updated>2003-12-13T18:30:02Z</updated>
    <author>
        <name>John Doe</name>
    </author>
    <id>urn:uuid:60a76c80-d399-11d9-b93C-0003939e0af6</id>

    <entry>
        <title>Atom-Powered Robots Run Amok</title>
        <link href="http://example.org/2003/12/13/atom03"/>
        <id>urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6a</id>
        <updated>2003-12-13T18:30:02Z</updated>
        <summary>Some text.</summary>
    </entry>

</feed>
<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
    <title type="text">dive into mark</title>
    <subtitle type="html">
        A &lt;em&gt;lot&lt;/em&gt; of effort went into making this effortless
    </subtitle>
    <updated>2005-07-31T12:29:29Z</updated>
    <id>tag:example.org,2003:3</id>
    <link rel="alternate" type="text/html"
        hreflang="en" href="http://example.org/"/>
    <link rel="self" type="application/atom+xml"
        href="http://example.org/feed.atom"/>
    <rights>Copyright (c) 2003, Mark Pilgrim</rights>
    <generator uri="http://www.example.com/" version="1.0">
        Example Toolkit
    </generator>
    <entry>
        <title>Atom draft-07 snapshot</title>
        <link rel="alternate" type="text/html"
            href="http://example.org/2005/04/02/atom"/>
        <link rel="enclosure" type="audio/mpeg" length="1337"
            href="http://example.org/audio/ph34r_my_podcast.mp3"/>
        <id>tag:example.org,2003:3.2397</id>
        <updated>2005-07-31T12:29:29Z</updated>
        <published>2003-12-13T08:29:29-04:00</published>
        <author>
            <name>Mark Pilgrim</name>
            <uri>http://example.org/</uri>
            <email>[email protected]</email>
        </author>
        <contributor>
            <name>Sam Ruby</name>
        </contributor>
        <contributor>
            <name>Joe Gregorio</name>
        </contributor>
        <content type="xhtml" xml:lang="en"
            xml:base="http://diveintomark.org/">
            <div xmlns="http://www.w3.org/1999/xhtml">
                <p><i>[Update: The Atom draft is finished.]</i></p>
            </div>
        </content>
    </entry>
</feed>

Notes

From RFC 4287:

This specification describes two kinds of Atom Documents: Atom Feed Documents and Atom Entry Documents.

Interpreted in PHP code that might look like:

abstract class AtomDocument
{
    /**
     * @var $authors ElementCollection
     */
    protected $authors;

    /**
     * @var $categories ElementCollection
     */
    protected $categories;

    /**
     * @var $contributors ElementCollection
     */
    protected $contributors;

    /**
     * @var $id AtomIdElement
     */
    protected $id;

    /**
     * @var $links ElementCollection
     */
    protected $links;

    /**
     * @var $rights AtomRightsElement
     */
    protected $rights;

    /**
     * @var $title AtomTitleElement
     */
    protected $title;

    /**
     * @var $updated AtomUpdatedElement
     */
    protected $updated;
}
class AtomFeedDocument extends AtomDocument
{
    /**
     * @var $generator AtomGeneratorElement
     */
    protected $generator;

    /**
     * @var $icon AtomIconElement
     */
    protected $icon;

    /**
     * @var $logo AtomLogoElement
     */
    protected $logo;

    /**
     * @var $subtitle AtomSubtitleElement
     */
    protected $subtitle;

    /**
     * @var $entries ElementCollection
     */
     protected $elements;
}
class AtomEntryDocument extends AtomDocument
{
    /**
     * @var $content AtomContentElement
     */
    protected $content;

    /**
     * @var $published AtomPublishedElement
     */
    protected $published;

    /**
     * @var $source AtomSourceElement
     */
    protected $source;

    /**
     * @var $summary AtomSummaryElement
     */
    protected $summary;
}

php-atom's People

Contributors

petersuhm avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.