Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Graphql Php Laravel Package

pixelandtonic/graphql-php

PHP implementation of the GraphQL specification (based on graphql-js). Build schemas, execute queries, and add custom types, fields, and resolvers. Install via Composer and explore full docs and ready-to-run examples.

View on GitHub
Deep Wiki
Context7

Union Type Definition

A Union is an abstract type that simply enumerates other Object Types. The value of Union Type is actually a value of one of included Object Types.

In graphql-php union type is an instance of GraphQL\Type\Definition\UnionType (or one of its subclasses) which accepts configuration array in a constructor:

<?php
use GraphQL\Type\Definition\UnionType;

$searchResultType = new UnionType([
    'name' => 'SearchResult',
    'types' => [
        MyTypes::story(),
        MyTypes::user()
    ],
    'resolveType' => function($value) {
        if ($value->type === 'story') {
            return MyTypes::story();            
        } else {
            return MyTypes::user();
        }
    }
]);

This example uses inline style for Union definition, but you can also use
inheritance or type language.

Configuration options

The constructor of UnionType accepts an array. Below is a full list of allowed options:

Option Type Notes
name string Required. Unique name of this interface type within Schema
types array Required. List of Object Types included in this Union. Note that you can't create a Union type out of Interfaces or other Unions.
description string Plain-text description of this type for clients (e.g. used by GraphiQL for auto-generated documentation)
resolveType callback function($value, $context, ResolveInfo $info) Receives $value from resolver of the parent field and returns concrete Object Type for this $value.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
ably/pubsub-server
mstfkhazaal/defender
mfonte/base62x
karnoweb/metapilot
tobya/bcsapiwrapper
swalker2/cpanel
vish4395/laravel-translation-manager
morningtrain/economic
teksite/systeminfo-laravel
atomcms/voting
run6/weather
siokas/laravelembeddirectives
adamlien/pkuuids
gilsonsouza/lara-doc-generator
manelgavalda/enrollment_mobile
unabomber/timezone
delatbabel/contacts
astritzeqiri/g-recaptcha
kevinongko/laravel-genode
developeruz/laravel-analytics