Download the PHP package infinityloop-dev/graphpinator-nette without Composer
On this page you can find all versions of the php package infinityloop-dev/graphpinator-nette. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download infinityloop-dev/graphpinator-nette
More information about infinityloop-dev/graphpinator-nette
Files in infinityloop-dev/graphpinator-nette
Package graphpinator-nette
Short Description Graphpinator adapters and addons for Nette framework.
License MIT
Homepage https://github.com/graphpql
Informations about the package graphpinator-nette
Graphpinator Nette

:zap::globe_with_meridians::zap: Graphpinator adapters and addons for Nette framework.
Introduction
This package includes adapters and tools to easily integrate Graphpinator into a Nette application.
Installation
Install package using composer
How to use
ApiPresenter
Simple version of a presenter to execute GraphQL API requests against a given schema. It can be extended to alter its functionality (for example by overriding the getEnabledModules
function) or it can serve as an inspiration to include the functionality in your own presenters.
Presenter is enabled by creating a route:
You also need to register the module with presenters to map to the correct namespace.
There needs to be a Schema
and a NetteCache
service available in your DI container so that it can be injected into the presenter.
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.
GraphiQLPresenter
Presenter which include GraphiQL, a graphical interface to interact with your schema.
Presenter is enabled by creating a route:
It is also required to pass a location of your API endpoint, to which GraphiQL will connect to.
Cyclic dependendencies
When using abstract types, the cyclic dependencies must be avoided using accessors. Nette makes it easy by automatically providing implementation for a accessor interface using a simple DI condifuration.
This interface is than injected into the abstract type instead of the concrete types in order to break the dependency cycle.
Multiple schemas
Some more sophisticated applications may require to host multiple different GraphQL schemas with different purposes. In order to do this, we need to use a different approach when configuring the DI.
It is reccomended to use a separate class for each Schema
so that it can be easily registered as a separate service and injected into a presenter.
Adapters
\Graphpinator\Nette\TracyLogger
- Implements logger interface for logging in
\Graphpinator\Graphpinator
.
- Implements logger interface for logging in
\Graphpinator\Nette\NetteRequestFactory
- Implements
RequestFactory
and enables direct creation of\Graphpinator\Request\Request
from Nette HTTP abstraction.
- Implements
\Graphpinator\Nette\FileProvider
- Implements
FileProvider
interface needed byinfinityloop-dev/graphpinator-upload
module.
- Implements
\Graphpinator\Nette\NetteCache
- Adapter from Nette Caching to Psr CacheInterface needed by
infinityloop-dev/graphpinator-persisted-queries
module.
- Adapter from Nette Caching to Psr CacheInterface needed by
All versions of graphpinator-nette with dependencies
infinityloop-dev/graphpinator-printer Version ^1.0
nette/application Version ^3.0
nette/http Version ^3.0
nette/caching Version ^3.0
latte/latte Version ^2.10.8 || ^3.0
tracy/tracy Version ^2.7
psr/simple-cache Version 3.0
guzzlehttp/psr7 Version ^2.4.3