Skip to content

API-Skeletons/laravel-doctrine-graphql

Repository files navigation

GraphQL for Doctrine using Hydrators for Laravel

Build Status Coverage PHPStan Documentation Status PHP Version Laravel Version Gitter Patreon Total Downloads License

This repository is a work in progress

This library uses Doctrine native traversal of related objects to provide full GraphQL querying of entities and all related fields and entities. Entity metadata is introspected and is therefore Doctrine data driver agnostic. Data is collected with hydrators thereby allowing full control over each field using hydrator filters, strategies and naming strategies. Multiple object managers are supported. Multiple hydrator configurations are supported. Works with GraphiQL.

A range of filters are provided to filter collections at any location in the query.

Doctrine provides easy taversal of your database. Consider the following imaginary query:

$entity[where id = 5]
  ->getRelation()
    ->getField1()
    ->getField2()
    ->getManyToOne([where name like '%dev%'])
      ->getName()
      ->getField3()
  ->getOtherRelation()
    ->getField4()
    ->getField5()

And see it realized in GraphQL with fine grained control over each field via hydrators:

  { 
    entity (filter: { id: 5 }) { 
      relation { 
        field1 
        field2 
        manyToOne (filter: { name_contains: 'dev' }) { 
          name 
          field3 
        } 
      } otherRelation { 
        field4 
        field5 
      } 
    } 
  }

Releases

No releases published

Packages

No packages published

Languages