Code Monkey home page Code Monkey logo

atom-feed-generator's Introduction

Atom Feed Generator

Build status StyleCI Status Code coverage Total Downloads Latest Stable Version License

This package helps you to very easily generate an Atom Feed for your website.

Installation

You can include this package through Composer using:

composer require roelofjan-elsinga/atom-feed-generator

Usage

use AtomFeedGenerator\AtomFeedGenerator;

/**@var \AtomFeedGenerator\FeedConfiguration $configuration*/

$generator = AtomFeedGenerator::withConfiguration($configuration);

// or

$generator = new AtomFeedGenerator($configuration);

/**@var \AtomFeedGenerator\FeedItem $feed_item*/

$generator->add($feed_item);

$atom_string = $generator->generate();

print $atom_string;

This will result in:

<?xml version="1.0" encoding="utf-8"?>

<feed xmlns="http://www.w3.org/2005/Atom">
    <title>Feed title</title>
    <link href="https://example.com"/>
    <updated>2019-01-01T12:00:00+00:00</updated>
    <author>
        <name>Feed Author</name>
    </author>
    <id>https://example.com</id>
    <link rel="self" href='https://example.com/feed'/>
    <entry>
        <title>Article title</title>
        <link href="https://example.com/articles/test-article"/>
        <id>https://example.com/articles/test-article</id>
        <updated>2019-01-02T12:00:00+00:00</updated>
        <published>2019-01-01T12:00:00+00:00</published>
        <content>This is the content of the item</content>
        <summary>This is the summary</summary>
        <media:content xmlns:media="http://search.yahoo.com/mrss/" url="/images/test-image.jpg" medium="image" type="image/jpeg" width="1920" height="1080" />
    </entry>
</feed>

Testing

You can run the included tests by running ./vendor/bin/phpunit in your terminal.

atom-feed-generator's People

Contributors

roelofjan-elsinga avatar

Watchers

James Cloos 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.