wwwision / neos-graphql
Experimental GraphQL API for the Neos Content Repository
Fund package maintenance!
bwaidelich
www.paypal.me/bwaidelich
Installs: 160
Dependents: 0
Suggesters: 0
Security: 0
Stars: 16
Watchers: 3
Forks: 3
Open Issues: 3
Type:neos-package
Requires
- neos/neos: ^4.2 || ^5.0 || ^5.1 || ^7.0
- wwwision/graphql: ^4.0
This package is auto-updated.
Last update: 2021-09-30 09:53:12 UTC
README
An experimental GraphQL API on top of the Neos Content Repository
Background
This package just comes with a set of GraphQL Type definitions that wrap the public API of the Neos Content Repository. It depends on the Wwwision.GraphQL package to provide the API endpoint and to render the GraphiQL IDE.
Installation
Within an existing Neos instance install the package using composer:
composer require wwwision/neos-graphql
Test whether the GraphQL Playground works by navigating to /neos/graphql
.
You should be redirected to the Neos Login form and then back to the GraphiQL interface.
Usage
All the types, queries and mutations are documented and in sync with the PHP API, so this should be pretty self-explanatory if you're familiar with GraphQL and/or with the GraphQL Playground.
Here are some random snapshots of the package in action:
A simple query to fetch a node in live workspace including its sub-pages:
Display other dimensions of a given node:
Move a node into another node and publish the workspace
(Note: this will copy the moved node into the "user-admin" workspace, that can then be published)
Disclaimer
This package was originally created to evaluate the usage of GraphQL to drive the Neos UI. Our current standpoint is: For this very scenario (or if one really needs all the low-level power of this API) this approach might be a viable way. For providing more high-level or public services for unknown clients to be consumed, there are probably better ways, including a good old REST API (btw: GraphQL positions itself as alternative to REST, not as replacement!).
While this package mainly wraps the existing PHP API it is still considered beta, mainly because of a few parts that are likely to change:
- The package key/namespace - I'm not happy with the current name. But if we happen to use it for the Neos Backend this will should be moved to the neos vendor namespace anyways.
- The return types of mutations - Currently they return a
MutationResult
with one success flag. This allows us to change the implementation to be asynchronous without breaking the types. But the current type is not very useful. - Some details of the type definitions might need to be revised