PHPackages                             mathsgod/graphql-php-directive-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. mathsgod/graphql-php-directive-resolvers

ActiveLibrary[API Development](/categories/api)

mathsgod/graphql-php-directive-resolvers
========================================

GraphQL directive resolver

1.0.1(6y ago)02501MITPHPCI failing

Since Jan 11Pushed 6y ago1 watchersCompare

[ Source](https://github.com/mathsgod/graphql-php-directive-resolvers)[ Packagist](https://packagist.org/packages/mathsgod/graphql-php-directive-resolvers)[ RSS](/packages/mathsgod-graphql-php-directive-resolvers/feed)WikiDiscussions master Synced 4d ago

READMEChangelog (2)Dependencies (3)Versions (3)Used By (1)

[![PHP Composer](https://github.com/mathsgod/graphql-php-directive-resolvers/workflows/PHP%20Composer/badge.svg?branch=master)](https://github.com/mathsgod/graphql-php-directive-resolvers/workflows/PHP%20Composer/badge.svg?branch=master)

Example
=======

[](#example)

Schema:

```
directive @upper on FIELD_DEFINITION

schema {
    query: Query
}

type Query {
    me: User
}

type User {
    first_name:String @upper
    last_name:String
}

```

Input:

```
query{
    me{
        first_name
    }
}

```

Result:

```
Array
(
    [data] => Array
        (
            [me] => Array
                (
                    [first_name] => MY FIRST NAME
                )

        )

)

```

Code
====

[](#code)

```
require_once(__DIR__ . "/../vendor/autoload.php");
use GraphQL\Utils\BuildSchema;
use GraphQL\GraphQL;

$schema_gql = getField("me")->resolveFn = function ($root, $args, $context, $info) {
    return ["first_name" => "my first name"];
};

$directiveResolvers = [
    "upper" => function ($next, $source, $args, $context) {
        return $next()->then(function ($str) {
            return strtoupper($str);
        });
    }
];

attachDirectiveResolvers($schema, $directiveResolvers);

//----- query data

$query = "query{
    me{
        first_name
    }
}
";
$result = GraphQL::executeQuery($schema, $query, $rootValue, null, $variableValues, $operationName);
$result = $result->toArray();

print_r($result);
```

###  Health Score

28

—

LowBetter than 52% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity62

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 ~495 days

Total

2

Last Release

2234d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/18732337?v=4)[Raymond](/maintainers/mathsgod)[@mathsgod](https://github.com/mathsgod)

---

Top Contributors

[![mathsgod](https://avatars.githubusercontent.com/u/18732337?v=4)](https://github.com/mathsgod "mathsgod (9 commits)")

---

Tags

graphqlgraphql-schemaphpgraphql

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[aws/aws-sdk-php

AWS SDK for PHP - Use Amazon Web Services in your PHP project

6.3k543.5M2.5k](/packages/aws-aws-sdk-php)[nuwave/lighthouse

A framework for serving GraphQL from Laravel

3.5k11.8M116](/packages/nuwave-lighthouse)[google/gax

Google API Core for PHP

267116.3M553](/packages/google-gax)[overblog/graphql-bundle

This bundle provides tools to build a GraphQL server in your Symfony App.

8028.4M36](/packages/overblog-graphql-bundle)[aimeos/ai-admin-graphql

Aimeos Admin GraphQL API extension

1.0k106.6k7](/packages/aimeos-ai-admin-graphql)[mll-lab/graphql-php-scalars

A collection of custom scalar types for usage with https://github.com/webonyx/graphql-php

1394.7M40](/packages/mll-lab-graphql-php-scalars)

PHPackages © 2026

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