Simple Json client plugin for Craft3 CMS. The plugin provides a simple Twig extension which allows you to fetch a Json url and use the result in your Twig template
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src Merge branch 'development' Sep 3, 2018
.gitignore
CHANGELOG.md Update changelog and version Sep 3, 2018
LICENSE.md first commit Jun 8, 2017
README.md Update README.md Dec 15, 2017
composer.json Update changelog and version Sep 3, 2018

README.md

Json Client plugin for Craft CMS 3.x

Simple Json client plugin for Craft3 CMS. The plugin provides a simple Twig extension which allows you to fetch a Json url and use the result in your Twig template.

Requirements

  • Craft 3.0 (beta 20)+
  • PHP 7.0+

Using the plugin

  1. Install it using composer or the plugin store.
  2. You can use it from your template

Using the plugin in your twig template

    {# Get a random Fact form chucknorris.io #}
    {% set jsonData = fetchJson({
    'url': 'https://api.chucknorris.io/jokes/random'
    }) %}

    <h1>Fact of the day</h1>
    {{ jsonData.value }}

Installing using composer

  1. Go to the project craft folder in the terminal and run

    composer require dolphiq/craft3-jsonclient
    
  2. Install plugin in the Craft Control Panel under Settings > Plugins

Roadmap

  • Create filters for xss scripts
  • Create more helper functions to parse the Json
  • Support multiple methods not only get
  • Provide a way to add the parameters separated from the uri

Contributors & Developers

Johan Zandstra - johan@dolphiq.nl Brought to you by Dolphiq