To change the default parameters, you have to use the Config class. Create a new instance and pass it to the Reader object like that:
use PicoFeed\Reader\Reader;
use PicoFeed\Config\Config;
$config = new Config;
$config->setClientUserAgent('My custom RSS Reader')
->setProxyHostname('127.0.0.1')
->setProxyPort(8118);
$reader = new Reader($config);
...
- Method name:
setClientTimeout()
- Default value: 10 seconds
- Argument value: number of seconds (integer)
$config->setClientTimeout(20); // 20 seconds
- Method name:
setClientUserAgent()
- Default value:
PicoFeed (https://github.com/fguillot/picoFeed)
- Argument value: string
$config->setClientUserAgent('My RSS reader');
- Method name:
setMaxRedirections()
- Default value: 5
- Argument value: integer
$config->setMaxRedirections(10);
- Method name:
setMaxBodySize()
- Default value: 2097152 (2MB)
- Argument value: value in bytes (integer)
$config->setMaxBodySize(10485760); // 10MB
- Method name:
setProxyHostname()
- Default value: empty
- Argument value: string
$config->setProxyHostname('proxy.example.org');
- Method name:
setProxyPort()
- Default value: 3128
- Argument value: port number (integer)
$config->setProxyPort(8118);
- Method name:
setProxyUsername()
- Default value: empty
- Argument value: string
$config->setProxyUsername('myuser');
- Method name:
setProxyPassword()
- Default value: empty
- Argument value: string
$config->setProxyPassword('mysecret');
- Method name:
setGrabberTimeout()
- Default value: 10 seconds
- Argument value: number of seconds (integer)
$config->setGrabberTimeout(20); // 20 seconds
- Method name:
setGrabberUserAgent()
- Default value:
PicoFeed (https://github.com/fguillot/picoFeed)
- Argument value: string
$config->setGrabberUserAgent('My content scraper');
- Method name:
setGrabberRulesFolder()
- Default value:
null
- Argument value: string
$config->setGrabberRulesFolder('/path/to/my/grabber/rules');
- Method name:
setParserHashAlgo()
- Default value:
sha256
- Argument value: any value returned by the function
hash_algos()
(string) - See: http://php.net/hash_algos
$config->setParserHashAlgo('sha1');
- Method name:
setContentFiltering()
- Default value: true (filtering is enabled by default)
- Argument value: boolean
$config->setContentFiltering(false);
- Method name:
setTimezone()
- Default value: UTC
- Argument value: See https://php.net/manual/en/timezones.php (string)
- Note: define the timezone for items/feeds
$config->setTimezone('Europe/Paris');
- Method name:
setTimezone()
- Default value: UTC
- Argument value: See https://php.net/manual/en/timezones.php (string)
- Note: define the timezone for the logging class
$config->setTimezone('Europe/Paris');
- Method name:
setFilterIframeWhitelist()
- Default value: See the Filter class source code
- Argument value: array
$config->setFilterIframeWhitelist(['http://www.youtube.com', 'http://www.vimeo.com']);
- Method name:
setFilterIntegerAttributes()
- Default value: See the Filter class source code
- Argument value: array
$config->setFilterIntegerAttributes(['width', 'height']);
- Method name:
setFilterAttributeOverrides()
- Default value: See the Filter class source code
- Argument value: array
$config->setFilterAttributeOverrides(['a' => ['target' => '_blank']);
- Method name:
setFilterRequiredAttributes()
- Default value: See the Filter class source code
- Argument value: array
- Note: If the required attributes are not there, the tag is stripped
$config->setFilterRequiredAttributes(['a' => 'href', 'img' => 'src']);
- Method name:
setFilterMediaBlacklist()
- Default value: See the Filter class source code
- Argument value: array
- Note: Tags are stripped if they have those URLs
$config->setFilterMediaBlacklist(['feeds.feedburner.com', 'share.feedsportal.com']);
- Method name:
setFilterMediaAttributes()
- Default value: See the Filter class source code
- Argument value: array
$config->setFilterMediaAttributes(['src', 'href']);
- Method name:
setFilterSchemeWhitelist()
- Default value: See the Filter class source code
- Argument value: array
- See: http://en.wikipedia.org/wiki/URI_scheme
$config->setFilterSchemeWhitelist(['http://', 'ftp://']);
- Method name:
setFilterWhitelistedTags()
- Default value: See the Filter class source code
- Argument value: array
- Note: Only those tags are allowed everything else is stripped
$config->setFilterWhitelistedTags(['a' => ['href'], 'img' => ['src', 'title']]);
- Method name:
setFilterImageProxyUrl()
- Default value: Empty
- Argument value: string
$config->setFilterImageProxyUrl('http://myproxy.example.org/?url=%s');
- Method name:
setFilterImageProxyCallback()
- Default value: null
- Argument value: Closure
$config->setFilterImageProxyCallback(function ($image_url) {
$key = hash_hmac('sha1', $image_url, 'secret');
return 'https://mypublicproxy/'.$key.'/'.urlencode($image_url);
});
- Method name:
setFilterImageProxyProtocol()
- Default value: Empty (all protocols)
- Argument value: string
$config->setFilterImageProxyProtocol('http');