{"id":15292813,"url":"https://github.com/mathsgod/graphql-php-directive-resolvers","last_synced_at":"2026-04-13T21:32:14.499Z","repository":{"id":62525134,"uuid":"165168282","full_name":"mathsgod/graphql-php-directive-resolvers","owner":"mathsgod","description":"A schema directive resolvers for webonyx/graphql-php","archived":false,"fork":false,"pushed_at":"2020-05-20T09:42:45.000Z","size":16,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-08T19:58:25.727Z","etag":null,"topics":["graphql","graphql-schema","php"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mathsgod.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-01-11T02:52:08.000Z","updated_at":"2020-05-20T09:42:12.000Z","dependencies_parsed_at":"2022-11-02T14:15:59.470Z","dependency_job_id":null,"html_url":"https://github.com/mathsgod/graphql-php-directive-resolvers","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/mathsgod/graphql-php-directive-resolvers","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mathsgod%2Fgraphql-php-directive-resolvers","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mathsgod%2Fgraphql-php-directive-resolvers/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mathsgod%2Fgraphql-php-directive-resolvers/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mathsgod%2Fgraphql-php-directive-resolvers/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mathsgod","download_url":"https://codeload.github.com/mathsgod/graphql-php-directive-resolvers/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mathsgod%2Fgraphql-php-directive-resolvers/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31771819,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-13T20:17:16.280Z","status":"ssl_error","status_checked_at":"2026-04-13T20:17:08.216Z","response_time":93,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["graphql","graphql-schema","php"],"created_at":"2024-09-30T16:27:30.859Z","updated_at":"2026-04-13T21:32:14.478Z","avatar_url":"https://github.com/mathsgod.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"![PHP Composer](https://github.com/mathsgod/graphql-php-directive-resolvers/workflows/PHP%20Composer/badge.svg?branch=master)\n\n# Example\nSchema:\n```\ndirective @upper on FIELD_DEFINITION\n\nschema {\n    query: Query\n}\n\ntype Query {\n    me: User\n}\n\ntype User {\n    first_name:String @upper\n    last_name:String\n}\n```\n\n\nInput: \n```\nquery{\n    me{\n        first_name\n    }\n}\n```\n\nResult:\n\n```\nArray\n(\n    [data] =\u003e Array\n        (\n            [me] =\u003e Array\n                (\n                    [first_name] =\u003e MY FIRST NAME\n                )\n\n        )\n\n)\n```\n\n# Code\n```php\n\nrequire_once(__DIR__ . \"/../vendor/autoload.php\");\nuse GraphQL\\Utils\\BuildSchema;\nuse GraphQL\\GraphQL;\n\n$schema_gql = \u003c\u003c\u003cgql\ndirective @upper on FIELD_DEFINITION\n\nschema {\n    query: Query\n}\n\ntype Query {\n    me: User\n}\n\ntype User {\n    first_name:String @upper\n    last_name:String\n}\ngql;\n\n$schema = BuildSchema::build($schema_gql);\n\n$schema-\u003egetType(\"Query\")-\u003egetField(\"me\")-\u003eresolveFn = function ($root, $args, $context, $info) {\n    return [\"first_name\" =\u003e \"my first name\"];\n};\n\n$directiveResolvers = [\n    \"upper\" =\u003e function ($next, $source, $args, $context) {\n        return $next()-\u003ethen(function ($str) {\n            return strtoupper($str);\n        });\n    }\n];\n\nattachDirectiveResolvers($schema, $directiveResolvers);\n\n//----- query data\n\n$query = \"query{\n    me{\n        first_name\n    }\n}\n\";\n$result = GraphQL::executeQuery($schema, $query, $rootValue, null, $variableValues, $operationName);\n$result = $result-\u003etoArray();\n\nprint_r($result);\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmathsgod%2Fgraphql-php-directive-resolvers","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmathsgod%2Fgraphql-php-directive-resolvers","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmathsgod%2Fgraphql-php-directive-resolvers/lists"}