Weave Code
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 Bundle Laravel Package

overblog/graphql-bundle

View on GitHub
Deep Wiki
Context7

Args builder

Builder is a way to don't repeat args definition.

Define your custom args builder:

#app/config/config.yml
overblog_graphql:
    #...
    definitions:
        #...
        builders:
            args:
                -
                    alias: "Pager"
                    class: "MyBundle\\GraphQL\\Args\\Pager"
#               using short syntax
#               Pager: "MyBundle\\GraphQL\\Args\\Pager"

Builder class must implement Overblog\GraphQLBundle\Definition\Builder\MappingInterface

<?php

namespace MyBundle\GraphQL\Args;

use Overblog\GraphQLBundle\Definition\Builder\MappingInterface;

class Pager implements MappingInterface
{
    public function toMappingDefinition(array $config): array
    {
        $defaultLimit = isset($config['defaultLimit']) ? (int)$config['defaultLimit'] : 20;

        return [
            'limit' => [
                'type' => 'Int!',
                'defaultValue' => $defaultLimit,
            ],
            'offset' => [
                'type' => 'Int!',
                'defaultValue' => 0,
            ],
        ];
    }
}

usage:

foo:
    type: "object"
    config:
        fields:
            categories:
                type: "[String!]!"
                argsBuilder: "Pager"

            categories2:
                type: "[String!]!"
                argsBuilder:
                    builder: "Pager"
                    config:
                        defaultLimit: 50

this is equivalent to:

foo:
    type: "object"
    config:
        fields:
            categories:
                type: "[String!]!"
                args:
                    limit:
                        type: "Int!"
                        defaultValue: 20
                    offset:
                        type: "Int!"
                        defaultValue: 0
            categories2:
                type: "[String!]!"
                args:
                    limit:
                        type: "Int!"
                        defaultValue: 50
                    offset:
                        type: "Int!"
                        defaultValue: 0
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.
daikazu/eloquent-salesforce-objects
unseen-codes/chat
romalytar/yammi-jobs-monitoring-laravel
kisame76/filament-db-table-state
nqxcode/laravel-lucene-search
dpfx/laravel-livewire-wizards
workos/workos-php-laravel
sofa/laravel-global-scope
nawasara/auth-primitives
adhocrat-io/arkhe-main
make-dev/orca-harpoon
itsemon245/lamet
baks-dev/dashboard
amoifr/pickle-panther-bundle
make-dev/orca
dmstr/symfony-system-resources-bundle
dmstr/symfony-job-queue-bundle
dmstr/openapi-json-schema-bundle
dmstr/keycloak-security-bundle
dmstr/doctrine-audit-log-bundle