mathsgod/r-graphql

There is no license information available for the latest version (1.5.0) of this package.

GraphQL for php

1.5.0 2020-05-20 09:20 UTC

This package is auto-updated.

Last update: 2024-12-07 13:12:39 UTC


README

PHP Composer

r-graphql

try {
    $schema = Schema::Build(file_get_contents(__DIR__ . "/schema.gql"), $this->app);
    
} catch (Exception $e) {
    return ["error" => [
        "message" => $e->getMessage()
    ]];
}

$this->request->getBody()->getContents();
$input = json_decode($input, true);
$query = $input['query'];
$variableValues = $input['variables'];

$schema->debug=true;//debug mode

$result = $schema->executeQuery($query, $variableValues);

$this->write(json_encode($result));

Scalar function added

JWT

try {
    $schema = Schema::Build(file_get_contents(__DIR__ . "/schema.gql"), $this->app);
    $schema->validation($jwt, $key, function ($payload)  {
        print_r($payload);
    });
} catch (Exception $e) {
    return ["error" => [
        "message" => $e->getMessage()
    ]];
}