infinityloop-dev / graphpinator-nette

:zap::globe_with_meridians::zap: Graphpinator adapters and addons for Nette framework.

Home Page:https://www.infinityloop.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Graphpinator Nette PHP codecov

🌐 Graphpinator adapters and addons for Nette framework.

Introduction

This package includes adapters for various Graphpinator functionalities and a SchemaPresenter, which returns a response with generated GraphQL type language document.

Installation

Install package using composer

composer require infinityloop-dev/graphpinator-nette

How to use

Adapters

  • \Graphpinator\Nette\TracyLogger
    • Implements logger interface for loggin in \Graphpinator\Graphpinator.
  • \Graphpinator\Nette\NetteRequestFactory
    • Implements RequestFactory and enables direct creation of \Graphpinator\Request\Request from Nette HTTP abstraction.
  • \Graphpinator\Nette\FileProvider
    • Implements FileProvider interface needed by infinityloop-dev/graphpinator-upload module.
  • \Graphpinator\Nette\NetteCache
    • Adapter from Nette Caching to Psr CacheInterface needed by infinityloop-dev/graphpinator-persisted-queries module.

SchemaPresenter

Schema presenter contains two actions.

  • actionHtml, which renders HTML page
  • actionFile, which renders text file - file is sent to browser as an attachment, which tells the browser to show the download prompt

Action can be enabled using Router, here is the example which enables the HTML action on the /schema.graphql path.

$router[] = new Route('/schema.graphql',
    'module' => 'Graphpinator',
    'presenter' => 'Schema',         
    'action' => 'html',
]);

It is also required to register the application-module to correct namespace.

application:
    mapping:
        Graphpinator: 'Graphpinator\Nette\*Presenter'

About

:zap::globe_with_meridians::zap: Graphpinator adapters and addons for Nette framework.

https://www.infinityloop.dev

License:MIT License


Languages

Language:PHP 97.8%Language:Latte 2.2%