Symfony bundle for GraphQLite: build a GraphQL API by adding PHP attributes
(#[Query], #[Mutation], #[Type], #[Field]...) to your classes. The bundle exposes the /graphql endpoint and
integrates GraphQLite with Symfony services, Security, Validator, file uploads and cache.
Documentation: docs/index.rst
- PHP 8.1+
- Symfony 6.4, 7.x or 8.x
- GraphQLite ^8
-
Install the bundle (Symfony Flex enables it and creates its configuration):
composer require thecodingmachine/graphqlite-bundle
-
Tell GraphQLite where your GraphQL classes live:
# config/packages/graphqlite.yaml graphqlite: namespace: controllers: App\GraphQL\Controller\ types: - App\Entity\ - App\GraphQL\Input\
-
Write your first query and call
/graphql:// src/GraphQL/Controller/HelloController.php namespace App\GraphQL\Controller; use TheCodingMachine\GraphQLite\Annotations\Query; class HelloController { #[Query] public function hello(string $name = 'world'): string { return sprintf('Hello %s', $name); } }
Continue with the getting started tutorial.
- Tests:
vendor/bin/simple-phpunit - Static analysis:
composer phpstan - The code examples of
docs/are tested: they must stay identical to the classes oftests/DocsFixtures/(seetests/DocsExamplesTest.php).