2017 © Pedro PelΓ‘ez
 

library atompub

Atom Publishing Protocol support library

image

mekras/atompub

Atom Publishing Protocol support library

  • Wednesday, August 17, 2016
  • by Mekras
  • Repository
  • 1 Watchers
  • 0 Stars
  • 5,013 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 7 Versions
  • 8 % Grown

The README.md

Atom Publishing Protocol support library

Latest Stable Version License Build Status Coverage Status, (*1)

Purpose

This library is designed to work with the AtomPub documents in an object-oriented style. It does not contain the functionality to download or display documents., (*2)

This library is an extension of the package Atom., (*3)

Parsing documents

use Mekras\Atom\Document\EntryDocument;
use Mekras\Atom\Document\FeedDocument;
use Mekras\Atom\Exception\AtomException;
use Mekras\AtomPub\Document\CategoryDocument;
use Mekras\AtomPub\Document\ServiceDocument;
use Mekras\AtomPub\DocumentFactory;

$factory = new DocumentFactory;

$xml = file_get_contents('http://example.com/atom');
try {
    $document = $factory->parseXML($xml);
} catch (AtomException $e) {
    die($e->getMessage());
}

if ($document instanceof CategoryDocument) {
    $categories = $document->getCategories();
    //...
} elseif ($document instanceof ServiceDocument) {
    $workspaces = $document->getWorkspaces();
    //...
} elseif ($document instanceof FeedDocument) {
    $feed = $document->getFeed();
    //...
} elseif ($document instanceof EntryDocument) {
    $entry = $document->getEntry();
    //...
}

Creating entries

use Mekras\AtomPub\DocumentFactory;

$factory = new DocumentFactory;
$document = $factory->createDocument('atom:entry');
$entry = $document->getEntry();
$entry->addId('urn:entry:0001');
$entry->addTitle('Entry Title');
$entry->addAuthor('Author 1')->setEmail('foo@example.com');
$entry->addContent('

Entry content

', 'html'); $entry->addCategory('tag1')->setLabel('Tag label')->setScheme('http://example.com/scheme'); $entry->addUpdated(new \DateTime()); // Suppose that $httpClient is some kind of HTTP client... $httpClient->sendRequest('POST', 'http://example.com/', (string) $document);

The Versions

17/08 2016

dev-master

9999999-dev

Atom Publishing Protocol support library

  Sources   Download

MIT

The Requires

 

The Development Requires

by ΠœΠΈΡ…Π°ΠΈΠ» ΠšΡ€Π°ΡΠΈΠ»ΡŒΠ½ΠΈΠΊΠΎΠ²

atom atompub

17/08 2016

v1.0.0

1.0.0.0

Atom Publishing Protocol support library

  Sources   Download

MIT

The Requires

 

The Development Requires

by ΠœΠΈΡ…Π°ΠΈΠ» ΠšΡ€Π°ΡΠΈΠ»ΡŒΠ½ΠΈΠΊΠΎΠ²

atom atompub

14/07 2016

v1.0.0-beta

1.0.0.0-beta

Atom Publishing Protocol support library

  Sources   Download

MIT

The Requires

 

The Development Requires

by ΠœΠΈΡ…Π°ΠΈΠ» ΠšΡ€Π°ΡΠΈΠ»ΡŒΠ½ΠΈΠΊΠΎΠ²

atom atompub

13/07 2016

v1.0.0-alpha

1.0.0.0-alpha

Atom Publishing Protocol support library

  Sources   Download

MIT

The Requires

 

The Development Requires

by ΠœΠΈΡ…Π°ΠΈΠ» ΠšΡ€Π°ΡΠΈΠ»ΡŒΠ½ΠΈΠΊΠΎΠ²

atom atompub

12/07 2016

v0.2.0

0.2.0.0

Atom Publishing Protocol support library

  Sources   Download

MIT

The Requires

 

The Development Requires

by ΠœΠΈΡ…Π°ΠΈΠ» ΠšΡ€Π°ΡΠΈΠ»ΡŒΠ½ΠΈΠΊΠΎΠ²

atom atompub

11/07 2016

v0.1.1

0.1.1.0

Atom Publishing Protocol support library

  Sources   Download

MIT

The Requires

 

The Development Requires

by ΠœΠΈΡ…Π°ΠΈΠ» ΠšΡ€Π°ΡΠΈΠ»ΡŒΠ½ΠΈΠΊΠΎΠ²

atom atompub

08/07 2016

v0.1.0

0.1.0.0

Atom Publishing Protocol support library

  Sources   Download

MIT

The Requires

 

The Development Requires

by ΠœΠΈΡ…Π°ΠΈΠ» ΠšΡ€Π°ΡΠΈΠ»ΡŒΠ½ΠΈΠΊΠΎΠ²

atom atompub