PHP code example of andi-lab / graphql-php
1. Go to this page and download the library: Download andi-lab/graphql-php 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/ */
andi-lab / graphql-php example snippets
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;
}
}