hecht-a / graphql-orm
GraphQL ORM for Symfony
Requires
- php: ^8.4
- phpstan/phpdoc-parser: ^2.3.1
- psr/event-dispatcher: ^1.0
- psr/log: ^3.0
- symfony/cache-contracts: ^3.5
- symfony/config: ^7.4 || ^8.0
- symfony/console: ^7.4 || ^8.0
- symfony/dependency-injection: ^7.4 || ^8.0
- symfony/filesystem: ^7.4 || ^8.0
- symfony/finder: ^7.4 || ^8.0
- symfony/http-client: ^7.4 || ^8.0
- symfony/http-foundation: ^7.4 || ^8.0
- symfony/http-kernel: ^7.4 || ^8.0
- symfony/stopwatch: ^7.4 || ^8.0
- symfony/string: ^7.4 || ^8.0
- symfony/type-info: ^7.4 || ^8.0
Requires (Dev)
- doctrine/collections: ^2.2 || ^3.0
- doctrine/persistence: ^3.0 || ^4.0
- knplabs/knp-components: ^5.3
- pagerfanta/core: ^4.10
- phpbench/phpbench: ^1.7
- phpstan/phpstan: ^2.2
- phpunit/phpunit: ^12.5
- symfony/cache: ^7.4.8 || ^8.0.8
- symfony/form: ^7.4 || ^8.0
- symfony/phpunit-bridge: ^8.0
- symfony/serializer: ^7.4 || ^8.0
- twig/twig: ^3.20
Suggests
- doctrine/collections: Hydrates the relations whose property is typed Collection as an ArrayCollection
- doctrine/orm: References GraphQL entities from Doctrine entities (#[GraphqlReference])
- knplabs/knp-paginator-bundle: Paginates the query builders with KnpPaginator, with a dialect paginating by offset
- pagerfanta/core: Paginates the query builders with Pagerfanta (GraphqlOrmAdapter), with a dialect paginating by offset
- phpstan/extension-installer: Enables the PHPStan rules checking field names (extension.neon)
- symfony/form: Enables GraphqlEntityType, a form field whose choices are entities
- symfony/serializer: Writes the entities without loading their lazy relations (GraphqlEntityNormalizer)
Provides
None
Conflicts
None
Replaces
None
- dev-main
- v5.13.0
- v5.12.0
- v5.11.0
- v5.10.2
- v5.10.1
- v5.10.0
- v5.9.0
- v5.8.1
- v5.8.0
- v5.7.1
- v5.7.0
- v5.6.0
- v5.5.0
- v5.4.0
- v5.3.0
- v5.2.0
- v5.1.1
- v5.1.0
- v5.0.0
- 4.x-dev
- v4.10.3
- v4.10.2
- v4.10.1
- v4.10.0
- v4.9.2
- v4.9.1
- v4.9.0
- v4.8.0
- v4.7.0
- v4.6.1
- v4.6.0
- v4.5.0
- v4.4.0
- v4.3.0
- v4.2.0
- v4.1.1
- v4.1.0
- v4.0.1
- v4.0.0
- v3.2.0
- v3.1.1
- v3.1.0
- v3.0.0
- v2.0.0
- v1.0.0
This package is auto-updated.
Last update: 2026-10-19 14:12:28 UTC
README
GraphQL ORM is a lightweight GraphQL ORM for PHP/Symfony, inspired by concepts from Doctrine ORM.
It allows you to map PHP objects to a GraphQL API using attributes, and provides repositories, a query builder, automatic hydration, relation handling, schema validation, and deep Symfony integration.
Installation
composer require hecht-a/graphql-orm
Requirements: PHP 8.4+ and Symfony 7.4 or 8.x.
The bundle relies on the HTTP client service provided by FrameworkBundle (framework.http_client, enabled by default
when symfony/http-client is installed).
Quick start
# config/packages/graphql_orm.yaml graphql_orm: endpoint: 'http://localhost:4000/graphql' mapping: entity: dir: '%kernel.project_dir%/src/GraphQL/Entity' namespace: App\GraphQL\Entity repository: dir: '%kernel.project_dir%/src/GraphQL/Repository' namespace: App\GraphQL\Repository
php bin/console graphqlorm:make:entity Task
$tasks = $taskRepository->findAll(); $qb = $taskRepository->createQueryBuilder(); $tasks = $qb ->select('id', 'title', 'user.name') ->where($qb->expr()->eq('status', 'active')) ->limit(10) ->getQuery() ->getResult();
Documentation
The documentation is published at https://hecht-a.github.io/graphql-orm/, and its pages live in docs/:
- Configuration
- Entity mapping
- Repositories
- Query Builder
- Pagination
- Dialects
- Schema validation
- Logging
- Profiler
- Events — metrics, tracing
- Hydration hooks —
#[BeforeHydrate],#[AfterHydrate] - Forms —
GraphqlEntityType, a choice among entities - Serializer — entities written without loading their lazy relations
- Doctrine — Doctrine entities referencing GraphQL entities
- Caching — result cache and second-level cache
- Several APIs — a manager for each API
- Console commands
- PHPStan rules — field names checked at analysis time
- Testing —
MockGraphqlServer, a GraphQL server for the tests of your application - Upgrading from 4.x
Supported versions
| Version | Status |
|---|---|
| 5.x | Maintained: new features and fixes |
| 4.x and earlier | No longer maintained since 5.11.0: no release, fix included; see upgrading |
License
MIT, see LICENSE.