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

Promise

The bundle is totally "promise ready", by default it use Webonyx/GraphQL-Php SyncPromise adapter (supporting the native deferred feature) and it also comes with ReactPHP/Promise adapter. To integrate an other promise implementation, you must create a new service that implements Overblog\GraphQLBundle\Executor\Promise\PromiseAdapterInterface or GraphQL\Executor\Promise\PromiseAdapter with a wait method that accepts a Promise like argument and returns the result of the promise resolved or throw an exception otherwise.

Config bundle to use the new service:

overblog_graphql:
    services:
        promise_adapter: "my.promise_adapter"

You can use the in box overblog_graphql.react.promise_adapter service to manage ReactPHP/Promise.

The overblog_graphql.promise_adapter service to create promises in resolver like this:

<?php

use GraphQL\Executor\Promise\PromiseAdapter;

class MyResolver
{
    public function __construct(PromiseAdapter $promiseAdapter)
    {
        $this->promiseAdapter = $promiseAdapter;
    }

    public function resolveQuery()
    {
        return $this->promiseAdapter->create(function (callable $resolve) {
            return $resolve(['name' => 'Luke']);
        });
    }
}

or using native supported promise like this:

<?php

use React\Promise\Promise as ReactPromise;

class MyResolver
{
    public function resolveQuery()
    {
        return new ReactPromise(function (callable $resolve) {
            return $resolve(['name' => 'Luke']);
        });
    }
}
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