arthem/graphql-mapper-bundle

The GraphQL Mapper Symfony Bundle

0.0.2 2016-05-20 19:46 UTC

This package is auto-updated.

Last update: 2024-03-29 02:52:59 UTC


README

Symfony bundle for GraphQL Mapper

Installation

This is installable via Composer as arthem/graphql-mapper-bundle:

composer require arthem/graphql-mapper-bundle

Setup / Configuration

Enable the bundle:

<?php
// app/AppKernel.php

// ...
class AppKernel extends Kernel
{
    public function registerBundles()
    {
        $bundles = array(
            // ...
            new Arthem\Bundle\GraphQLBundle\ArthemGraphQLBundle(),
        );

        // ...
    }

    // ...
}

Create your schema:

# app/config/graphql_schema.yml

# Your schema here

See graphql-mapper documentation

Then declare your mapping file in the bundle configuration:

# app/config/config.yml

arthem_graphql:
    mapping:
        files:
            - %kernel.root_dir%/config/graphql_schema.yml

Setup routing:

# app/config/routing.yml
arthem_graphql:
    resource: "@ArthemGraphQLBundle/Resources/config/routing.yml"
    prefix:   /graphql

Usage

Just call POST /app_dev.php/graphql/query with a "query" in the body

License

Released under the MIT License.