Configuration#

Create a consume.php file under your /config directory with the following options available to you. You can also use multi-environment options to change these per environment.

The below shows the defaults already used by Consume, so you don't need to add these options unless you want to modify the values.

<?php

return [
    '*' => [
        'pluginName' => 'Consume',
        'enableCache' => true,
        'cacheDuration' => 'PT1H',
    ]
];

Configuration options#

  • pluginName - If you wish to customise the plugin name.
  • enableCache - Whether to enable the cache for data.
  • cacheDuration - When the cache is enabled, how long data is cached for. Accepts a Date Interval (opens new window) or a number of seconds.

Clients#

Supply your client configurations as per the below. The key for each item should be the client handle.

return [
    'clients' => [
        'facebook' => [
            'enabled' => true,
            'clientId' => 'xxxxxxxxxxxx',
            'clientSecret' => 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
        ],
        'myCustomClient' => [
            'url' => 'https://my-app.test/some/path',

            // Add any query params for the client
            'queryParams' => [
                'limit' => '10',
            ],

            // Add any headers for the client
            'headers' => [
                'api-key' => 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
            ],

            // If your client needs to use HTTP Basic Auth...
            'httpAuth' => [
                'username' => 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
                'password' => 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
            ],
        ],
    ],
];

Control Panel#

You can also manage configuration settings through the Control Panel by visiting Settings → Consume.

Previous ← Requirements Next Clients →

Get started with Consume

Available for Craft 4. Get it from the plugin store.