2017 © Pedro Peláez
 

library metropublisher-php-sdk

A simple wrapper for the MetroPublisher API.

image

michaeljamesparsons/metropublisher-php-sdk

A simple wrapper for the MetroPublisher API.

  • Monday, January 8, 2018
  • by MichaelJamesParsons
  • Repository
  • 1 Watchers
  • 0 Stars
  • 26 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 3 Open issues
  • 7 Versions
  • 4 % Grown

The README.md

MetroPublisher SDK Beta

Build Status Codacy Badge License, (*1)

This is a fully featured SDK for the MetroPublisherTM REST API. It takes care of the boilerplate HTTP client request/response logic for you so you can dive right into implementing the API into your app., (*2)

Installation

The recommended method of installation is through composer., (*3)

composer require michaeljamesparsons/metropublisher-php-sdk

Dependencies

If you are using composer, these dependencies should be installed automatically., (*4)

Quickstart

<?php
use MetroPublisher\MetroPublisher;
use MetroPublisher\Api\Models\Article;

//Create a new MetroPublisher API instance
$metroPublisher = new MetroPublisher("{public key}", "{secret key}");

//Create a new article
$article = new Article($metroPublisher);
$article->setUuid('41b47ff8-3355-4f69-a867-7232165e6d29')
    ->setUrlname('lorem-ipsum')
    ->setTitle('Lorem Ipsum')
    ->setMetaTitle('Lorem Ipsum')
    ->setDescription('Lorem ipsum dolor sit amet, consectetur adipiscing elit.')
    ->setMetaDescription('Lorem ipsum dolor sit amet, consectetur adipiscing elit.')
    ->setPrintDescription('Lorem ipsum dolor sit amet, consectetur adipiscing elit.')
    ->setContent('

Quisque sed erat sed ex eleifend sollicitudin eu id ligula., (*5)

') ->setFeatureImageUuid(null) ->setTeaserImageUuid(null) ->setIssued(new DateTime('now')) ->setEvergreen(true); //Save the article $article->save(); //Delete the article $article->delete();

Dictionary

Models

A model represents an object in the MetroPublisher API. For example, this could be an article, event, location, or other object. The properties of these objects map to the fields defined for that object in the official API resource reference., (*6)

Resource Models

A resource model is a type of model which, unlike non-resource models, can be saved to the API or deleted from it. Some resource models have extra methods that allow them to fetch other models that are related to them. Not all of the resource models have been implemented, but I've listed the ones that are ready for you below!, (*7)

  • Article
  • Event
  • AlbumReview
  • BookReview
  • LocationReview
  • Location
  • Tag
  • TagCategory
  • Slot
  • ExternalSlotMedia
  • EmbedSlotMedia
  • FileSlotMedia

Non-Resource Models

Non-resource models are dependent on another resource model to exist. For example, the path_history model cannot be saved or deleted from the API. It simply represents meta-data from another model., (*8)

  • PathHistory

Collections

Each resource model has a corresponding collection object. A collection object allows you to fetch groups of a resource model, an individual resource model, or groups of models that are related to the resource model., (*9)

<?php
use MetroPublisher\Api\Collections\ArticleCollection;

$articleCollection = new ArticleCollection($metroPublisher);

//Get group of articles
$articles = $articleCollection->findAll();

//Get next group of articles
$moreArticles = $articleCollection->findAll(2);

//Get a single article
$singleArticle = $articleCollection->find('e6ebac9c-94cb-11e6-ae22-56b6b6499611');

Tests

Unit tests are located in the /tests directory. Full coverage is in progress., (*10)

./vendor/bin/phpunit

Todo

  • [x] Implement HttpClient interface
  • [ ] Cache parsed model annotations
  • [ ] Support directly associating objects along side UUIDs
  • [ ] Make collections iterable

License

Released under the MIT license., (*11)

The Versions

08/01 2018

dev-master

9999999-dev

A simple wrapper for the MetroPublisher API.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Michael-James Parsons

api wrapper metropublisher

08/01 2018

0.2.1

0.2.1.0

A simple wrapper for the MetroPublisher API.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Michael-James Parsons

api wrapper metropublisher

05/12 2017

dev-version-0.x

dev-version-0.x

A simple wrapper for the MetroPublisher API.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Michael-James Parsons

api wrapper metropublisher

05/12 2017

0.2.0

0.2.0.0

A simple wrapper for the MetroPublisher API.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Michael-James Parsons

api wrapper metropublisher

22/10 2017

0.1.1

0.1.1.0

A simple wrapper for the MetroPublisher API.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Michael-James Parsons

api wrapper metropublisher

15/09 2017

dev-revisions

dev-revisions

A simple wrapper for the MetroPublisher API.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Michael-James Parsons

api wrapper metropublisher

21/10 2016

0.1.0

0.1.0.0

A simple wrapper for the MetroPublisher API.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Michael-James Parsons

api wrapper metropublisher