PHPackages                             infinityloop-dev/graphpinator-query-cost - 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. infinityloop-dev/graphpinator-query-cost

ActiveLibrary[API Development](/categories/api)

infinityloop-dev/graphpinator-query-cost
========================================

Modules to limit maximum query cost by resticting maximum depth or number of nodes.

v2.0.1(4mo ago)29.3k↓38.1%1[5 PRs](https://github.com/graphpql/graphpinator-query-cost/pulls)1MITPHPCI passing

Since Jun 24Pushed 3mo ago1 watchersCompare

[ Source](https://github.com/graphpql/graphpinator-query-cost)[ Packagist](https://packagist.org/packages/infinityloop-dev/graphpinator-query-cost)[ Docs](https://github.com/graphpql/)[ RSS](/packages/infinityloop-dev-graphpinator-query-cost/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (7)Dependencies (14)Versions (14)Used By (1)

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://camo.githubusercontent.com/f699039a23d0adefdb08251ece4389d796725761d9b8d08169cee39b1f7adc7e/68747470733a2f2f636f6465636f762e696f2f67682f696e66696e6974796c6f6f702d6465762f677261706870696e61746f722d71756572792d636f73742f6272616e63682f6d61737465722f67726170682f62616467652e737667)](https://codecov.io/gh/infinityloop-dev/graphpinator-query-cost)
========================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================

[](#graphpinator-query-cost--)

⚡🌐⚡ Modules to limit query cost by restricting maximum depth or number of nodes.

Introduction
------------

[](#introduction)

Installation
------------

[](#installation)

Install package using composer

`composer require infinityloop-dev/graphpinator-query-cost`

How to use
----------

[](#how-to-use)

This package includes two modules. They can be used together or each on their own.

- `MaxDepthModule` validates maximum depth of a query.
- `MaxNodesModule` validates that size of a query does not exceed maximum number of nodes.
    - One node is essentially a single value which is to be resolved.
    - This module automatically recognises "multiplier" arguments, such as `limit`, which multiply inner number of nodes for that field.
        - Default multiplier arguments are `['limit', 'first', 'last']`, but can be changed using second constructor argument.
        - If you wish to disable this feature, set the constructor argument to empty array.

1. Register selected modules to GraPHPinator:

```
$depthModule = new \Graphpinator\QueryCost\MaxDepthModule(
    10, // selected maximum depth
);
$nodesModule = new \Graphpinator\QueryCost\MaxNodesModule(
    10000, // selected number of nodes
    ['limit'], // optional: multiplier argument names
);
$graphpinator = new \Graphpinator\Graphpinator(
    $schema,
    $catchExceptions,
    new \Graphpinator\Module\ModuleSet([$depthModule, $nodesModule /* possibly other modules */]),
    $logger,
);
```

2. You are all set, queries are validated for maximum depth/maximum number of nodes.

###  Health Score

48

—

FairBetter than 95% of packages

Maintenance78

Regular maintenance activity

Popularity29

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 84.4% 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 ~276 days

Recently: every ~404 days

Total

7

Last Release

133d ago

Major Versions

1.2 → v2.02025-12-19

### Community

Maintainers

![](https://www.gravatar.com/avatar/00654c913028f8d25a226eb2ddf368e1b999bf72fa4f77dbd1449c1df218756c?d=identicon)[peldax](/maintainers/peldax)

---

Top Contributors

[![peldax](https://avatars.githubusercontent.com/u/10790033?v=4)](https://github.com/peldax "peldax (38 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (7 commits)")

---

Tags

graphqlgraphql-phpphp

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/infinityloop-dev-graphpinator-query-cost/health.svg)

```
[![Health](https://phpackages.com/badges/infinityloop-dev-graphpinator-query-cost/health.svg)](https://phpackages.com/packages/infinityloop-dev-graphpinator-query-cost)
```

###  Alternatives

[twilio/sdk

A PHP wrapper for Twilio's API

1.6k92.9M272](/packages/twilio-sdk)[facebook/php-business-sdk

PHP SDK for Facebook Business

90821.9M34](/packages/facebook-php-business-sdk)[meilisearch/meilisearch-php

PHP wrapper for the Meilisearch API

74513.7M114](/packages/meilisearch-meilisearch-php)[google/common-protos

Google API Common Protos for PHP

173103.7M50](/packages/google-common-protos)[hubspot/api-client

Hubspot API client

23914.2M16](/packages/hubspot-api-client)[botman/driver-telegram

Telegram driver for BotMan

92437.3k6](/packages/botman-driver-telegram)

PHPackages © 2026

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