{"id":20111938,"url":"https://github.com/graphpql/graphpinator-query-cost","last_synced_at":"2026-01-05T12:21:30.591Z","repository":{"id":48915308,"uuid":"371164116","full_name":"graphpql/graphpinator-query-cost","owner":"graphpql","description":":zap::globe_with_meridians::zap: Modules to limit query cost by restricting maximum depth or number of nodes.","archived":false,"fork":false,"pushed_at":"2023-11-10T15:33:06.000Z","size":122,"stargazers_count":2,"open_issues_count":1,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-04-24T03:18:05.945Z","etag":null,"topics":["graphql","graphql-php","php"],"latest_commit_sha":null,"homepage":"https://github.com/graphpql","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/graphpql.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2021-05-26T20:43:06.000Z","updated_at":"2023-12-02T13:59:10.000Z","dependencies_parsed_at":"2024-03-31T10:51:15.901Z","dependency_job_id":"ab38b59e-2195-479d-9682-ad4b776685c9","html_url":"https://github.com/graphpql/graphpinator-query-cost","commit_stats":null,"previous_names":["graphpql/graphpinator-query-cost","infinityloop-dev/graphpinator-query-cost"],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/graphpql%2Fgraphpinator-query-cost","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/graphpql%2Fgraphpinator-query-cost/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/graphpql%2Fgraphpinator-query-cost/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/graphpql%2Fgraphpinator-query-cost/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/graphpql","download_url":"https://codeload.github.com/graphpql/graphpinator-query-cost/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224500019,"owners_count":17321619,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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-php","php"],"created_at":"2024-11-13T18:18:16.430Z","updated_at":"2026-01-05T12:21:30.585Z","avatar_url":"https://github.com/graphpql.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# GraPHPinator Query cost [![PHP](https://github.com/infinityloop-dev/graphpinator-query-cost/workflows/PHP/badge.svg?branch=master)](https://github.com/infinityloop-dev/graphpinator-query-cost/actions?query=workflow%3APHP) [![codecov](https://codecov.io/gh/infinityloop-dev/graphpinator-query-cost/branch/master/graph/badge.svg)](https://codecov.io/gh/infinityloop-dev/graphpinator-query-cost)\n\n:zap::globe_with_meridians::zap: Modules to limit query cost by restricting maximum depth or number of nodes.\n\n## Introduction\n\n\n\n## Installation\n\nInstall package using composer\n\n```composer require infinityloop-dev/graphpinator-query-cost```\n\n## How to use\n\nThis package includes two modules. They can be used together or each on their own.\n- `MaxDepthModule` validates maximum depth of a query.\n- `MaxNodesModule` validates that size of a query does not exceed maximum number of nodes. \n    - One node is essentially a single value which is to be resolved. \n    - This module automatically recognises \"multiplier\" arguments, such as `limit`, which multiply inner number of nodes for that field.\n        - Default multiplier arguments are `['limit', 'first', 'last']`, but can be changed using second constructor argument.\n        - If you wish to disable this feature, set the constructor argument to empty array.\n\n1. Register selected modules to GraPHPinator:\n\n```php\n$depthModule = new \\Graphpinator\\QueryCost\\MaxDepthModule(\n    10, // selected maximum depth\n);\n$nodesModule = new \\Graphpinator\\QueryCost\\MaxNodesModule(\n    10000, // selected number of nodes\n    ['limit'], // optional: multiplier argument names\n);\n$graphpinator = new \\Graphpinator\\Graphpinator(\n    $schema,\n    $catchExceptions,\n    new \\Graphpinator\\Module\\ModuleSet([$depthModule, $nodesModule /* possibly other modules */]),\n    $logger,\n);\n```\n\n2. You are all set, queries are validated for maximum depth/maximum number of nodes.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgraphpql%2Fgraphpinator-query-cost","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgraphpql%2Fgraphpinator-query-cost","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgraphpql%2Fgraphpinator-query-cost/lists"}