webignition / website-rss-feed-finder
Find the RSS feed from a given website base URL
Installs: 11 677
Dependents: 0
Suggesters: 0
Security: 0
Stars: 13
Watchers: 4
Forks: 4
Open Issues: 0
Requires
- php: >=7.2.0
- guzzlehttp/guzzle: ~6
- webignition/absolute-url-deriver: ^3.0
- webignition/internet-media-type: >=2,<3
- webignition/uri: ^0.4.0
- webignition/web-resource-retriever: >=1,<2
Requires (Dev)
- phpstan/phpstan: ^0.11.5
- phpunit/phpunit: ^7
- squizlabs/php_codesniffer: ^3
README
Overview
Finds the RSS or ATOM feed URL for a given website. That's all.
Usage
The "Hello World" example
<?php $finder = new webignition\WebsiteRssFeedFinder\WebsiteRssFeedFinder(); $finder->setRootUrl('http://codinghorror.com/blog/'); $this->assertEquals('http://feeds.feedburner.com/codinghorror/', $finder->getRssFeedUrl()); $finder->setRootUrl('http://www.geekyportal.com/'); $this->assertEquals('http://www.geekyportal.com/feeds/posts/default', $finder->getAtomFeedUrl()); );
Building
Using as a library in a project
If used as a dependency by another project, update that project's composer.json and update your dependencies.
"require": {
"webignition/website-rss-feed-finder": "*"
}
Developing
This project has external dependencies managed with composer. Get and install this first.
# Make a suitable project directory
mkdir ~/website-rss-feed-finder && cd ~/website-rss-feed-finder
# Clone repository
git clone git@github.com:webignition/website-rss-feed-finder.git.
# Retrieve/update dependencies
composer.phar install
Testing
Have look at the project on travis for the latest build status, or give the tests a go yourself.
cd ~/website-rss-feed-finder
phpunit
An instance of WebsiteRssFeedFinder
can be passed an HTTP client with which
to retrieve the content of the specified sitemap URL.
Examine the existing unit tests to see how you can pass in a mock HTTP client to enable testing without the need to perform actual HTTP requests.