Skip to content
 
 

Repository files navigation

Scrutinizer Code Quality Code Coverage Build Status Code Intelligence Status Code Coverage Psalm Level

GraphQL library

The GraphQL library for PHP allows you to define a GraphQL API using attributes, interfaces, and prepared abstract classes.

Features

Key features of the library include:

  • framework agnostic, currently integrated with SpiralFramework on RoadRunner;
  • support code first & schema first principles, which can simultaneously complement each other;
  • extending via middleware layers.

Simple Example

use Andi\GraphQL\Attribute\Argument;
use Andi\GraphQL\Attribute\MutationField;
use Andi\GraphQL\Attribute\QueryField;

final class SimpleController
{
    #[QueryField(name: 'echo')]
    #[MutationField(name: 'echo')]
    public function echoMessage(#[Argument] string $message): string
    {
        return 'echo: ' . $message;
    }
}

This example shows how easy it is to define Query & Mutation. At the same time, the library provides full control when defining a GraphQL schema: custom types, required fields, default values, and much more.

Documentation

Documentation is currently available in:

Examples

The library includes examples of defining a GraphQL schema. All definitions mentioned in the documentation are present in the examples in one form or another.

License

See LICENSE

Community

Telegram group: GraphQL library for PHP

Roadmap

  • release 1.0
    • documentation of the development of middleware layers, with an example
    • documentation and example of connecting the ecodev/graphql-upload library for uploading files
    • support multiple schemas for andi-lab/graphql-php-spiral
  • release 1.1
    • mockup types and fields
  • other release
    • inputs validate
    • integration with Apollo Federation

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages