besmartand-pro / graphqlite-bundle
A Symfony bundle for thecodingmachine/graphqlite.
Package info
github.com/BeSmartAnd-Pro/graphqlite-bundle
Type:symfony-bundle
pkg:composer/besmartand-pro/graphqlite-bundle
Requires
- php: >=8.2
- composer-runtime-api: ^2.0
- ext-json: *
- besmartand-pro/graphqlite-symfony-validator-bridge: ^1.1
- kcs/class-finder: ^0.6.1
- laminas/laminas-diactoros: ^3
- nyholm/psr7: ^1.8.2
- symfony/config: ^7.4 || ^8.0
- symfony/console: ^7.4 || ^8.0
- symfony/framework-bundle: ^7.4 || ^8.0
- symfony/psr-http-message-bridge: ^7.4 || ^8.0
- symfony/translation: ^7.4 || ^8.0
- symfony/validator: ^7.4 || ^8.0
- thecodingmachine/cache-utils: ^1
- thecodingmachine/graphqlite: ^8.3.1
- webmozart/assert: ^1.11 || ^2.0
Requires (Dev)
- beberlei/porpaginas: ^2.3
- composer/semver: ^3.4
- overblog/graphiql-bundle: ^0.2 || ^0.3 || ^1
- phpstan/phpstan: ^2
- phpstan/phpstan-symfony: ^2.0
- phpunit/phpunit: ^11.5
- symfony/phpunit-bridge: ^7.4 || ^8.0
- symfony/runtime: ^7.4 || ^8.0
- symfony/security-bundle: ^7.4 || ^8.0
- symfony/yaml: ^7.4 || ^8.0
Suggests
- ecodev/graphql-upload: If you want to support file upload inside GraphQL input types (v7/v8)
- overblog/graphiql-bundle: Install to enable the GraphiQL UI (e.g. /graphiql).
- symfony/security-bundle: To use #[Logged] or #[Right] attributes
Provides
None
Conflicts
- symfony/password-hasher: <6.4
- thecodingmachine/safe: <3.3
Replaces
None
This package is auto-updated.
Last update: 2026-09-16 12:09:37 UTC
README
GraphQLite bundle
Symfony bundle for the thecodingmachine/graphqlite package.
It discovers your annotated controllers and types, builds the schema, exposes the /graphql endpoint through a PSR-7
bridge (with optional upload handling), and keeps the Symfony request available as the GraphQL context.
Part of the bundle docs: https://graphqlite.thecodingmachine.io/docs/symfony-bundle
See thecodingmachine/graphqlite.
Requirements
- PHP 8.2+ and Composer 2
- Supports:
- Symfony ^7.4 or ^8.0 (Symfony 8 requires PHP 8.4+)
- GraphQLite ^8.3.1
Installation
composer require besmartand-pro/graphqlite-bundle:^4.0
Enable the bundle in config/bundles.php if it is not already registered:
TheCodingMachine\GraphQLite\Bundle\GraphQLiteBundle::class => ['all' => true],
Configure routes
Import the bundle routes to expose /graphql:
# config/routes/graphqlite.yaml graphqlite_bundle: resource: '@GraphQLiteBundle/Resources/config/routes.php'
Configure namespaces
Configure independent schemas using the fork's namespaces map. Each schema may scan several PHP namespaces:
# config/packages/graphqlite.yaml graphqlite: namespaces: default: controllers: App\GraphQL\PublicApi\Controller types: - App\GraphQL\PublicApi\Type - App\Entity admin: controllers: - App\GraphQL\AdminApi\Controller - App\GraphQL\Reports\Controller types: App\GraphQL\AdminApi\Type
The default schema is served at /graphql and /graphql/default; admin is served at /graphql/admin.
Unknown schema names return HTTP 404. A default schema is optional. Schema names accept letters, digits,
underscores and hyphens. Keep scanned PHP namespaces disjoint where endpoints must expose different operations.
Endpoint selection does not grant authorization: configure Symfony firewalls/access control for private endpoints.
The upstream single-schema namespace: {controllers: ..., types: ...} configuration is also accepted as
default; do not combine it with namespaces.default. Security/debug options and explicitly tagged GraphQL
services apply to every schema. Each schema has a separate discovery cache and request context.
php bin/console graphqlite:dump-schema admin php bin/console graphqlite:dump-schema default --output=schema.graphql
Upgrading from 3.x
- Keep existing
namespacesconfiguration andgraphqlite_endpointroute name. - Update PHP to 8.2+ and Symfony to 7.4+ (or Symfony 8 with PHP 8.4+).
- Bundle sources moved to
src/; PSR-4 class names and bundle route imports remain unchanged. - Keep
besmartand-pro/graphqlite-symfony-validator-bridge; version ^1.1 retains the fork's validation exception changes. GraphQLiteControllernow takesServerConfigManager, followed by the optional PSR HTTP factory, debug flag and HTTP status decider. Update manual controller construction if applicable.- Default
Schema,SchemaFactoryandServerConfigservice aliases exist only when a default schema is configured. - Development uses PHPUnit 11.5 and PHPStan 2. The abandoned
composer/package-versions-deprecateddependency is removed; Composer's nativeInstalledVersionsAPI is used by the upstream tests.
Quickstart
Create a controller with GraphQLite attributes:
<?php // src/GraphQL/Controller/HelloController.php namespace App\GraphQL\Controller; use TheCodingMachine\GraphQLite\Annotations\Query; final class HelloController { #[Query] public function hello(string $name = 'world'): string { return sprintf('Hello %s', $name); } }
Features
- Auto-discovers controllers and types from configured namespaces and registers GraphQLite services, query providers, type mappers, and middleware through Symfony autoconfiguration
- Ships a
/graphqlroute that converts Symfony requests to PSR-7 and keeps the Symfony request in the GraphQL context - Passes the Symfony request as context to allow using them in queries/mutations
- Supports multipart uploads when
graphql-uploadis installed - Integrates with Symfony Security for
#[Logged]/#[Right]checks - Expose
login/logoutmutations plus amequery (opt-out) - Symfony Validator-based user input validation
- Lets you cap introspection, query depth, and query complexity via configuration
- Uses isolated Symfony PHP-file cache pools for each schema
- Includes a
graphqlite:dump-schemaconsole command to export GraphQL SDL
GraphiQL (playground)
The bundle wires Overblog’s GraphiQL bundle if it is installed. See https://github.com/overblog/GraphiQLBundle for
enabling the UI alongside the /graphql endpoint.
Development
- Tests:
vendor/bin/phpunit - Static analysis:
composer phpstan