Parser options 4.0+
📝 Name: parserOptions · 🖥️ Option: --parser-options
Additional config for configurable parsers.
INFO
These options only apply to configurable parsers. If the configured parser does not implement the required interface, a warning is shown.
Example
Pass parser options in the expected input format.
IMPORTANT
When passing parser options as command parameter or environment variable, make sure to pass them as JSON-encoded string.
./cache-warmup.phar --parser-options '{"request_options": {"proxy": "http://localhost:8125"}}'{
"parserOptions": {
"request_options": {
"proxy": "http://localhost:8125"
}
}
}use EliasHaeussler\CacheWarmup;
return static function (CacheWarmup\Config\CacheWarmupConfig $config) {
$config->setParserOption('request_options', [
'proxy' => 'http://localhost:8125',
]);
return $config;
};parserOptions:
request_options:
proxy: 'http://localhost:8125'CACHE_WARMUP_PARSER_OPTIONS='{"request_options": {"proxy": "http://localhost:8125"}}'Option Reference
The default parser is implemented as configurable parser:
The following configuration options are currently available for the default parser:
request_headers 4.0+
🎨 Type: array<string, mixed> · 🐝 Default: ['User-Agent' => '<default user-agent>']
A list of HTTP headers to send when fetching external XML sitemaps.
INFO
The default User-Agent is built in RequestFactory::createUserAgentHeader().
./cache-warmup.phar --parser-options '{"request_headers": {"X-Foo": "bar", "User-Agent": "Foo-Crawler/1.0"}}'{
"parserOptions": {
"request_headers": {
"X-Foo": "bar",
"User-Agent": "Foo-Crawler/1.0"
}
}
}use EliasHaeussler\CacheWarmup;
return static function (CacheWarmup\Config\CacheWarmupConfig $config) {
$config->setParserOption('request_headers', [
'X-Foo' => 'bar',
'User-Agent' => 'Foo-Parser/1.0',
]);
return $config;
};parserOptions:
request_headers:
X-Foo: bar
User-Agent: 'Foo-Parser/1.0'CACHE_WARMUP_PARSER_OPTIONS='{"request_headers": {"X-Foo": "bar", "User-Agent": "Foo-Parser/1.0"}}'request_options 4.0+
🎨 Type: array<string, mixed> · 🐝 Default: []
Additional request options used when fetching external XML sitemaps.
./cache-warmup.phar --parser-options '{"request_options": {"verify": false}}'{
"parserOptions": {
"request_options": {
"verify": false
}
}
}use EliasHaeussler\CacheWarmup;
return static function (CacheWarmup\Config\CacheWarmupConfig $config) {
$config->setParserOption('request_options', [
'verify' => false,
]);
return $config;
};parserOptions:
request_options:
verify: falseCACHE_WARMUP_PARSER_OPTIONS='{"request_options": {"verify": false}}'