A plugin for Craft CMS 3 that consumes Element API JSON and makes it available in your Twig templates.
This plugin requires Craft CMS 3.0.0-RC1 or later and a valid JSON file generated by Craft's Element API.
To install the plugin, follow these instructions.
-
Open your terminal and go to your Craft project:
cd /path/to/project
-
Then tell Composer to load the plugin:
composer require mijingo/liefer
-
In the Control Panel, go to Settings → Plugins and click the “Install” button for Liefer.
Pass in a JSON URL or location (best is one generated by the Element API) and then output the data to your Twig template.
{% set quotes = craft.liefer.get({url: 'https://something.com/quotes.json')} %}
{% for quote in quotes %}
{{ quote.body }}
{% endfor %}
Enable caching on the Element API source.
Some things to do, and ideas for potential features:
- Add caching support
Brought to you by Mijingo
JSON File by useiconic.com from the Noun Project