PHPackages                             infinityloop-dev/graphpinator-where-directives - 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-where-directives

ActiveLibrary[API Development](/categories/api)

infinityloop-dev/graphpinator-where-directives
==============================================

Executable directives to filter values in lists.

v1.0.4(2y ago)32.5k2[3 PRs](https://github.com/graphpql/graphpinator-where-directives/pulls)1MITPHPCI passing

Since Feb 12Pushed 2mo ago1 watchersCompare

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

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

GraPHPinator Where directives [![PHP](https://github.com/infinityloop-dev/graphpinator-where-directives/workflows/PHP/badge.svg?branch=master)](https://github.com/infinityloop-dev/graphpinator-where-directives/actions?query=workflow%3APHP) [![codecov](https://camo.githubusercontent.com/1df923a381229919cf82746b8e0d30e010e8376be7c841c49e05d308c8473110/68747470733a2f2f636f6465636f762e696f2f67682f696e66696e6974796c6f6f702d6465762f677261706870696e61746f722d77686572652d646972656374697665732f6272616e63682f6d61737465722f67726170682f62616467652e737667)](https://codecov.io/gh/infinityloop-dev/graphpinator-where-directives)
============================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================

[](#graphpinator-where-directives--)

⚡🌐⚡ Executable directives to filter values in lists.

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

[](#introduction)

This package allows client to filter list values using directives. Filtration happens on server, the most common use case is to save bandwidth when client knows exactly which data it needs.

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

[](#installation)

Install package using composer

`composer require infinityloop-dev/graphpinator-where-directives`

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

[](#how-to-use)

> ⚠️ **These directives do NOT replace standard and optimal filtering provided by arguments and underlying technologies.** These directives serve only as an addition to these.

> ⚠️ **These directives are executable directives. Their usage is requested by client.** Think twice before including this functionality on your server.

In order to enable where directives on your server, the only thing you need to do is to put selected directives to your `Container`. You may use all or only some.

> `ListWhereDirective` has a special requirement on `infinityloop-dev/graphpinator-constraint-directives`, which needs to be enabled first if you wish to use `@listWhere`.

This package contains following directives:

- `\Graphpinator\WhereDirectives\StringWhereDirective`
- `\Graphpinator\WhereDirectives\IntWhereDirective`
- `\Graphpinator\WhereDirectives\FloatWhereDirective`
- `\Graphpinator\WhereDirectives\BooleanWhereDirective`
- `\Graphpinator\WhereDirectives\ListWhereDirective`

### Directive options

[](#directive-options)

#### Common options

[](#common-options)

All directives have three common arguments

- `field` (String) - This optional argument allows filtering of nested structures. Represents path to navigate into filtered value.
    - For more information visit following [section](#Field-argument).
- `orNull` (Boolean) - Whether to accept null as a value which satisfies condition (default false).
- `not` (Boolean) - Negate the result of value conditions (default false).

#### Specific options

[](#specific-options)

- `@stringWhere`
    - equals
    - contains
    - startsWith
    - endsWith
- `@intWhere` &amp; `@floatWhere`
    - equals
    - greaterThan
    - lessThan
- `@booleanWhere`
    - equals
- `@listWhere`
    - minItems
    - maxItems

#### Priority of operations

[](#priority-of-operations)

Priority can be described using following code snippet:

```
$conditionIsMet = $value === null
    ? $orNull
    : satisfiesSpecificConditions($value);
$valueIsFilteredOut = $conditionIsMet === $not;
```

This effectively means that `not` argument has lowest priority and negates even the `orNull` argument.

### Field argument

[](#field-argument)

Let's say we have a list of `BlogPost` objects with some fields in it. Then, to receive all blogposts, we could have a query like this.

```
{ blogposts { title content likeCount author { name } } }
```

What if client needs only popular blogpost, with more than 100 likes, and server provides no relevant filtering options?

```
{ blogposts @intWhere(field: "likeCount", greaterThan: 100) { title content likeCount author { name } } }
```

What if client needs only post from author named "Foo Bar" ?

```
{ blogposts @stringWhere(field: "author.name", equals: "Foo Bar") { title content likeCount author { name } } }
```

###  Health Score

41

—

FairBetter than 89% of packages

Maintenance56

Moderate activity, may be stable

Popularity21

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity60

Established project with proven stability

 Bus Factor1

Top contributor holds 79.2% 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 ~125 days

Recently: every ~244 days

Total

9

Last Release

920d ago

### 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] (6 commits)")[![vossik](https://avatars.githubusercontent.com/u/22434658?v=4)](https://github.com/vossik "vossik (2 commits)")[![dependabot-preview[bot]](https://avatars.githubusercontent.com/in/2141?v=4)](https://github.com/dependabot-preview[bot] "dependabot-preview[bot] (1 commits)")[![HonzaBejvl](https://avatars.githubusercontent.com/u/23004049?v=4)](https://github.com/HonzaBejvl "HonzaBejvl (1 commits)")

---

Tags

graphqlgraphql-phpphp

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

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

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

###  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)
