rakshazi / local-content
Download full content from RSS/Atom feeds to local files and use it in offline
dev-master
2016-03-26 20:42 UTC
Requires
- fguillot/picofeed: ^0.1.19
- greg0/lazer-database: ^1.1
This package is auto-updated.
Last update: 2024-11-13 21:27:37 UTC
README
This library downloads content of rss/atom feeds (include images) to local files and allows you to use them as offline copy of preferred sites.
Installation
composer require rakshazi/local-content:dev-master
Usage
<?php require 'vendor/autoload.php'; /** * Array of feeds. * Structure: array('FEED_URL' => 'FEED_CATEGORY'); */ $feeds = array('https://github.com/fguillot/picoFeed/commits/master.atom' => 'development'); //Grabber User-Agent. You can use default $useragent = 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.116 Safari/537.36'; /** * Grabber rules. * @link https://github.com/fguillot/picoFeed/blob/master/docs/grabber.markdown#how-to-write-a-grabber-rules-file */ $rules_dir = '/storage/rules/'; //here will be saved images $media_dir = '/storage/media/'; //here will be saved content from feeds in JSON db $database_dir = '/storage/database/'; //timezone for posts, you can use default. $timezone = 'UTC'; //Init LocalContent object $lc = new \Rakshazi\LocalContent; //Configure it $lc ->setRulesDir($rules_dir) ->setMediaDir($media_dir) ->setDatabaseDir($database_dir) ->setFeeds($feeds) ->setUserAgent($useragent) ->setTimezone($timezone); //Download content! $lc->download();