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
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');
- 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.
- Array of Post objects can be accessed via:
$postsArray = $blogObject->getPosts();
php $post->getTitle();
php $post->getLink();
php $post->getCreator();
php $post->getPubDate();
php $post->getSummary();
- returns first 120 characters appended by "..."
php $post->getHeaderImage();
- returns first image found in post
- returns false if no images were found
php $post->getCollectionOfImages();
- returns array of all images found within that post
php $post->getContent();
- returns just the content within p tags
php $post->getFullContent();
- returns full content as received
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.