/medium-rss-parser

MediumRSSParser is an open source project allowing users to get all their Medium posts and parsing them into easy to use PHP objects due to the lack of GET functionality in Medium's API.

Primary LanguagePHPMIT LicenseMIT

Medium RSS Parser

Medium-rss-parser is an open source project allowing users to get all their Medium posts and parsing them into easy to use PHP objects due to the lack of GET functionality in Medium's API. Posts are split into:

  • Title
  • Link
  • Creator
  • Publish Date (DateTime Object)
  • Summary - first 120 characters of the blog post
  • Header Image - first image to be found in post
  • Full Content - all images and text in post as they appear
  • Content - just the text of the post
  • Collection of Images (Array) - tags for every image in the post

Downloading and using MediumRSSParser

In order to use MediumRSSParser in your project, download the library and store in your path of choice wihtin your project:

	require('path/to/BlogObject.php');

API Reference

BlogObject

  1. Constructor that accepts a Medium profile RSS feed in the format:
	$blogObject = new BlogObject("https://medium.com/feed/@lucaperic.lp");

and it auto populates an instance array of all Post objects found throughout the feed.

  1. Array of Post objects can be accessed via:
	$postsArray = $blogObject->getPosts();

Post

Public methods available:
  1. php $post->getTitle();
  2. php $post->getLink();
  3. php $post->getCreator();
  4. php $post->getPubDate();
  5. php $post->getSummary();
    • returns first 120 characters appended by "..."
  6. php $post->getHeaderImage();
    • returns first image found in post
    • returns false if no images were found
  7. php $post->getCollectionOfImages();
    • returns array of all images found within that post
  8. php $post->getContent();
    • returns just the content within p tags
  9. php $post->getFullContent();
    • returns full content as received

Contributing

Feel free to contribute to the project and if you provide valid code, I'll try get to including them asap. I'm no longer maintaining this repo.