Download the PHP package wwwision/cr-graphql without Composer

On this page you can find all versions of the php package wwwision/cr-graphql. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package cr-graphql

Wwwision.CR.GraphQL

Simple GraphQL Adapter for the Neos Content Repository

Description

This package provides a simple GraphQL API for Neos Content Repositories. It can be used in a Neos distribution or with a standalone Content Repository.

Disclaimer: This is merely an experiment. Feel free to use it or copy and adjust it to your needs, but please be aware of the limitations:

Limitations

Installation

Install this package via composer:

Routes

This package comes with corresponding routes, but they won't be active by default. This can be changed via some Settings.yaml:

Note: The path variable defines the URL path, the GraphQL API will be exposed to, with the above example this will be https://your-server.tld/graphql.

Adjust policies

If installed in a Neos distribution, the GraphQL controller is usually not allowed to be called by unauthenticated users. This can be changed with the following lines in a Configuration/Policy.yaml file:

Usage

If installed correctly, you should be able to query the GraphQL endpoint. You can try it via cURL:

This should return something like

Node properties

The properties of a node are represented via a NodeProperties scalar. In practice this means, that the properties will be converted to plain JSON in the result. This package uses the Symfony Serializer to convert non-scalar properties. The common object types (DateTime, node references, assets & images) are covered by custom Normalizers. You can easily configure additional types or change the behavior of the existing ones.

Add custom normalizers

This package already provides a AssetNormalizer that converts asset to an JSON object like:

To add a custom conversion for Video assets we could create a new Normalizer:

And register it via Settings.yaml:

Note: We need to set the position to "start" so that this new normalizer is evaluated before the existing AssetNormalizer (since that also supports Video properties).

Replace existing normalizers

If you want to replace/remove an existing normalizer you can do so by overriding the corresponding settings:

Example Queries

A couple of example GraphQL queries:

Get a single Node by its id

The result on the Neos.Demo site would be something like:

Get all document nodes recursively

GraphQL doesn't support recursive queries (for some good reasons) but it's possible to use fragments in order to get around that limitation. The following query will fetch the root node (/sites), all site nodes (for example /sites/neosdemo) and then all nodes below that implement the Neos.Neos:Document node type up to 5 levels:

The result could look like this:

Get all content nodes on a given document node, recursively

As mentioned above, endless recursion is not possible. But with the following query you can fetch all content and content collection nodes underneath the node with the specified identifier up to 5 levels:

With the following variables:


All versions of cr-graphql with dependencies

PHP Build Version
Package Version
Requires neos/flow Version *
t3n/graphql Version ^2.1 | ^3.0
neos/content-repository Version ^5.0 | ^7.0
symfony/serializer Version ^5.1
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package wwwision/cr-graphql contains the following files

Loading the files please wait ....