PHPackages                             diasfs/graphql-php-resolvers - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. diasfs/graphql-php-resolvers

ActiveLibrary[API Development](/categories/api)

diasfs/graphql-php-resolvers
============================

Directive and Field resolvers for graphql-php

1.0.1(7y ago)1159[1 issues](https://github.com/diasfs/graphql-php-resolvers/issues)MITPHP

Since Feb 12Pushed 7y ago1 watchersCompare

[ Source](https://github.com/diasfs/graphql-php-resolvers)[ Packagist](https://packagist.org/packages/diasfs/graphql-php-resolvers)[ RSS](/packages/diasfs-graphql-php-resolvers/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependencies (1)Versions (3)Used By (0)

GraphQL Resolvers
=================

[](#graphql-resolvers)

[![License](https://camo.githubusercontent.com/ec34e22eb182c733cbbe100730a05a4a6cd89c28e2b0f5513aad6ad6a1e01b58/68747470733a2f2f706f7365722e707567782e6f72672f65636f6465762f6772617068716c2d75706c6f61642f6c6963656e73652e706e67)](https://packagist.org/packages/diasfs/graphql-php-resolvers)

Simplified resolvers for [webonyx/graphql-php](https://github.com/webonyx/graphql-php).

Quick start
-----------

[](#quick-start)

Install the library via composer:

```
composer require diasfs/graphql-php-resolvers
```

### Field Resolver

[](#field-resolver)

```
require __DIR__ . "/vendor/autoload.php";
use GraphQL\Utils\BuildSchema;
use GraphQL\GraphQL;
use GraphQL\Resolvers\FieldResolver;

$schema_gql =  array(
        'hello' => "Hello World!"
    )
);

$schema = BuildSchema::build($schema_gql, function($typeConfig) use ($data) {

    return FieldResolver::TypeConfigDecorator($typeConfig, function($type_name, $field_name) use ($data) {
        return $data[$type_name][$field_name];
    });

});

$query =  Hello World!
        )
)
```

### Directive Resolver

[](#directive-resolver)

```
require __DIR__ . "/vendor/autoload.php";
use GraphQL\Utils\BuildSchema;
use GraphQL\GraphQL;
use GraphQL\Resolvers\FieldResolver;
use GraphQL\Resolvers\DirectiveResolver;

$schema_gql =  array(
        'hello' => "Hello",
        'world' => "World",
    )
);

$schema = BuildSchema::build($schema_gql, function($typeConfig) use ($data) {

    return FieldResolver::TypeConfigDecorator($typeConfig, function($type_name, $field_name) use ($data) {
        return $data[$type_name][$field_name];
    });

});

$directives = array(
    'upper' => function($next, $directiveArgs, $value, $args, $context, $info) {
        return $next($value, $args, $ctx, $info)->then(function($str) {
            return strtolupper($str);
        });
    },
    'lower' => function($next, $directiveArgs, $value, $args, $context, $info) {
        return $next($value, $args, $ctx, $info)->then(function($str) {
            return strtolower($str);
        });
    }
);

DirectivesResolver::bind($schema, function($name) use ($directives) {
    return $directives[$name];
});

$query =  HELLO
            [world] => world
        )
)
```

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance0

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity61

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

2

Last Release

2644d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/9d721b0374850bd8800cbda2537e464f8a451227930a439a82b2a1eb1ea8e457?d=identicon)[diasfs](/maintainers/diasfs)

---

Top Contributors

[![diasfs](https://avatars.githubusercontent.com/u/1634828?v=4)](https://github.com/diasfs "diasfs (2 commits)")

### Embed Badge

![Health badge](/badges/diasfs-graphql-php-resolvers/health.svg)

```
[![Health](https://phpackages.com/badges/diasfs-graphql-php-resolvers/health.svg)](https://phpackages.com/packages/diasfs-graphql-php-resolvers)
```

###  Alternatives

[saloonphp/saloon

Build beautiful API integrations and SDKs with Saloon

2.4k9.6M467](/packages/saloonphp-saloon)[google/gax

Google API Core for PHP

263103.1M453](/packages/google-gax)[flix-tech/confluent-schema-registry-api

A PHP 7.4+ library to consume the Confluent Schema Registry REST API.

484.2M3](/packages/flix-tech-confluent-schema-registry-api)[benmorel/ebay-sdk-php

An eBay SDK for PHP. Fork of dts/ebay-sdk-php with support for PHP 8.

32447.9k](/packages/benmorel-ebay-sdk-php)[firstred/postnl-api-php

PostNL REST API PHP Bindings

27610.2k1](/packages/firstred-postnl-api-php)[rezozero/mixedfeed

A PHP library to get social networks feeds and merge them

11130.4k](/packages/rezozero-mixedfeed)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
