PHP code example of amazeelabs / graphql_directives
1. Go to this page and download the library: Download amazeelabs/graphql_directives library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
amazeelabs / graphql_directives example snippets
namespace Drupal\my_directives\Plugin\GraphQL\Directive;
use Drupal\graphql_directives\DirectiveInterface;
/**
* @Directive(
* id="echo",
* description="Return the same string that you put in.",
* arguments = {
* "input" = "String!",
* }
* )
*/
class EchoDirective extends PluginBase implements DirectiveInterface {
/**
* {@inheritdoc}
*/
public function buildResolver(
ResolverBuilder $builder,
array $arguments
) : ResolverInterface {
return $builder->fromValue($arguments['input']);
}
}