Configuration
Create a feed-me.php file under your /config directory with any of the following. Feed Me’s configuration file allows customization per-environment and per-feed (see feedOptions).
<?php
return [
'*' => [
'pluginName' => 'Feed Me',
'cache' => 60,
'enabledTabs' => '*',
'clientOptions' => [],
'requestOptions' => [],
'compareContent' => true,
'skipUpdateFieldHandle' => 'skipFeedMeUpdate',
'backupLimit' => 100,
'dataDelimiter' => '-|-',
'csvColumnDelimiter' => ',',
'parseTwig' => false,
'sleepTime' => 0,
'logging' => true,
'runGcBeforeFeed' => false,
'queueTtr' => null,
'queueMaxRetry' => 5,
'assetDownloadCurl' => false,
'assetDownloadGuzzle' => true,
'allowedPrivateHosts' => [],
'feedOptions' => [
'1' => [
'feedUrl' => 'https://specialurl.io/feed.json',
'requestOptions' => [],
]
],
]
];Configuration options
pluginName— Optionally change the name of the plugin.cache— For template calls, change the default cache time.enabledTabs— Hide tabs in the Feed Me navigation. Pass an array with one or more of:feeds,logs, andsettings. This does not affect permissions, only the tabs’ visibility!clientOptions— An array of Guzzle client options to be merged with Craft’s defaults. When downloading remote assets, theauth,cookies,cert, andssl_keyoptions and anyAuthorizationorCookieheaders are only sent to assets on the same origin (scheme, host, and port) as the feed URL. Credentials added by custom handler middleware are sent with every asset download.requestOptions— Any additional options to be sent with requests when fetching your feed content Guzzle request options. See an example below.compareContent— Whether to check against existing element content before updating. This can have considerable performance improvements and prevent against needless updating.skipUpdateFieldHandle— Feed Me checks the provided field handle on each element that would be updated while processing a feed. If its value is exactly'1', the element is skipped. This behavior only supports legacy Lightswitch fields in Craft 3.x. If you need to control which elements in a feed are updated, consider preventing it via thecraft\feedme\services\Process::EVENT_STEP_BEFORE_PARSE_CONTENTevent.backupLimit— Set a limit to the number of backups to keep.dataDelimiter— Feed Me will try and split field values based on this delimiter. Useful for table, checkboxes, and multiselect fields.csvColumnDelimiter— Optionally set the delimiter for columns in CSVs before fetching the content.parseTwig— Whether to parse field data and default values for Twig. Disabled by default. If you enable this option, you should also ensure thatenableTwigSandboxis enabled in your Craft CMS installation to prevent malicious code from being executed.sleepTime— Add the number of seconds to sleep after each feed item has been processed.logging— Set the level of logging to do. Possible values aretrue(default) to log everything,falseto disable logging orerrorto only record errors.runGcBeforeFeed— Whether to run the Garbage Collection service before running a feed.queueTtr— Set the 'time to reserve' time in seconds, to prevent the job being cancelled after 300 seconds (default).queueMaxRetry— Set the maximum amount of retries the queue job should have before failing.assetDownloadGuzzle— Deprecated. Whether to use Guzzle to download assets from a remote source. Defaults totrue. When set tofalse, Feed Me will use curl ifassetDownloadCurlis enabled, orfopen()otherwise.assetDownloadCurl— Deprecated. Whether to use curl to download assets from a remote source. Only takes effect whenassetDownloadGuzzleis set tofalse. If both settings arefalse, Feed Me falls back tofopen().allowedPrivateHosts— Hostnames that are allowed to resolve to private IP addresses (e.g.10.0.0.0/8,192.168.0.0/16), for feeds and assets served from internal services. By default, URLs that resolve to private IP addresses are rejected. Can only be set inconfig/feed-me.php, and not per feed viafeedOptions. See ExampleallowedPrivateHosts.feedOptions— Provide an array of any of the above options (or feed settings) to set or override for specific feeds, keyed by their existing feed IDs. Note that feed IDs may be different across environments!
WARNING
The assetDownloadGuzzle and assetDownloadCurl settings are deprecated, and support for downloading remote assets with curl or fopen() will be removed in a future version of Feed Me. Remove both settings from your config file to use Guzzle.
fopen() is the least secure of the three options, as it doesn’t pin the connection to the IP addresses Feed Me has validated, so we recommend avoiding it.
Example requestOptions
See Guzzle Options for the full range:
'requestOptions' => [
'headers' => [
'Accept' => 'application/json',
],
'auth' => [
'username', 'password'
],
'query' => [
'foo' => 'bar'
],
],Example allowedPrivateHosts
Use an exact hostname, or a leading *. wildcard to match any subdomain (*.site.testing.local matches api.site.testing.local, but not site.testing.local itself):
'allowedPrivateHosts' => [
'feeds.internal',
'*.ddev.site',
],Only the private IP range check is relaxed for these hosts. Loopback, link-local and cloud metadata addresses are still rejected.
WARNING
Only list hostnames whose DNS you control, and list individual services rather than whole internal domains.
Control Panel
You can also manage configuration settings through the control panel by visiting Settings → Feed Me.