getpop/graphql-server

This package is abandoned and no longer maintained. The author suggests using the graphql-by-pop/graphql-server package instead.

GraphQL server in PHP, implemented through the PoP API

dev-master / 1.0.x-dev 2020-08-08 04:30 UTC

This package is auto-updated.

Last update: 2020-08-08 04:40:18 UTC


README

GraphQL server in PHP, implemented through the PoP API

Install

Installing the GraphQL server

Follow the instructions in the GraphQL by PoP installation page.

Installing the library in a PoP application

Via Composer

composer require graphql-by-pop/graphql-server

To enable pretty API endpoint /api/graphql/, follow the instructions here

Usage

Initialize the component:

\PoP\Root\ComponentLoader::initializeComponents([
    \PoP\GraphQLServer\Component::class,
]);

100% compliant of GraphQL syntax

All GraphQL queries are supported (click on the links below to try them out in GraphiQL):

GraphQL by PoP supports query batching. This query contains all queries from above:

Extended GraphQL

An upgraded implementation of the GraphQL server, which enables to resolve queries as a scripting language, is found under this repo.

It supports several features not currently defined by the GraphQL spec, including composable fields and composable directives.

Support for REST

By installing the REST package, the GraphQL server can also satisfy REST endpoints, from a single source of truth. Check out these example links:

Demo

The GraphQL API (running on top of a WordPress site) is deployed under this endpoint: https://newapi.getpop.org/api/graphql/

You can play with it through the following clients:

Standards

PSR-1, PSR-4 and PSR-12.

Change log

Please see CHANGELOG for more information on what has changed recently.

Testing

composer test

Static Analysis

Execute phpstan with level 5:

composer analyse

To run checks for level 0 (or any level from 0 to 8):

./vendor/bin/phpstan analyse -l 0 src tests

Contributing

Please see CONTRIBUTING and CODE_OF_CONDUCT for details.

Security

If you discover any security related issues, please email leo@getpop.org instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.