hecht-a / graphql-orm
GraphQL ORM for Symfony
Installs: 7
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 0
Forks: 0
Open Issues: 0
Type:symfony-bundle
pkg:composer/hecht-a/graphql-orm
Requires
- php: ^8.2
- psr/log: ^3.0
- symfony/config: ^7.1
- symfony/console: ^7.1
- symfony/dependency-injection: ^7.1
- symfony/filesystem: ^7.1
- symfony/finder: ^7.1
- symfony/http-client: ^7.1
- symfony/http-foundation: ^7.1
- symfony/http-kernel: ^7.1
- symfony/stopwatch: ^7.1
Requires (Dev)
- phpunit/phpunit: ^12.5
- symfony/phpunit-bridge: ^8.0
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
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(); $tasks = $taskRepository->createQueryBuilder() ->select('id', 'title', 'user.name') ->where($qb->expr()->eq('status', 'active')) ->limit(10) ->getQuery() ->getResult();
Documentation
- Configuration
- Entity mapping
- Repositories
- Query Builder
- Pagination
- Dialects
- Schema validation
- Logging
- Profiler
- Hydration hooks —
#[BeforeHydrate],#[AfterHydrate] - Console commands