PHPackages                             compwright/graphql-php-jetpack - 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. compwright/graphql-php-jetpack

ActiveLibrary[API Development](/categories/api)

compwright/graphql-php-jetpack
==============================

Easily enable support for custom scalars and directives with https://github.com/webonyx/graphql-php

v2.3.0(1y ago)16.6k↓14.3%MITPHPPHP ^7.4 || ^8.0

Since Jan 31Pushed 1y ago1 watchersCompare

[ Source](https://github.com/compwright/graphql-php-jetpack)[ Packagist](https://packagist.org/packages/compwright/graphql-php-jetpack)[ GitHub Sponsors](https://github.com/sponsors/compwright)[ RSS](/packages/compwright-graphql-php-jetpack/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (9)Dependencies (8)Versions (12)Used By (0)

graphql-php-jetpack
===================

[](#graphql-php-jetpack)

Unlock new [graphql-php](https://github.com/webonyx/graphql-php) superpowers with Jetpack scalar and directive support

[![Validate](https://github.com/compwright/graphql-php-jetpack/actions/workflows/validate.yml/badge.svg)](https://github.com/compwright/graphql-php-jetpack/actions/workflows/validate.yml)[![GitHub license](https://camo.githubusercontent.com/fe28d574932969ddde24386c0ec00f9c74429fe07791514b267abee80a367bc5/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f636f6d707772696768742f6772617068716c2d7068702d6a65747061636b2e737667)](https://github.com/compwright/graphql-php-jetpack/blob/master/LICENSE)[![Packagist](https://camo.githubusercontent.com/6c81fc2c6756a61bc6240b20e5b49cc5154596db7c75907c53f212b534956928/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f636f6d707772696768742f6772617068716c2d7068702d6a65747061636b2e737667)](https://packagist.org/packages/compwright/graphql-php-jetpack)[![Packagist](https://camo.githubusercontent.com/02edd46454a58fc12575f38d026af320e731467cbd38c9fa5a53236045ffc58d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f636f6d707772696768742f6772617068716c2d7068702d6a65747061636b2e737667)](https://packagist.org/packages/compwright/graphql-php-jetpack)

Features
--------

[](#features)

- Improve your GraphQL schema validation with custom scalars
- Post-process resolved field values with directives

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

[](#installation)

```
$ composer require compwright/graphql-php-jetpack

```

Usage
-----

[](#usage)

Install Jetpack schema support at schema build time:

```
use Compwright\GraphqlPhpJetpack\JetpackDecorator;
use GraphQL\Utils\BuildSchema;

$schemaTypeDecorator = new JetpackDecorator();
$schema = BuildSchema::build($ast, $schemaTypeDecorator);
```

Install Jetpack directive support at server config build time:

```
use Compwright\GraphqlPhpJetpack\DirectiveResolver;
use GraphQL\Server\ServerConfig;
use GraphQL\Type\Definition\ResolveInfo;

$resolver = function ($root, array $args, $context, ResolveInfo $info) {
    // resolve field value
    return $root;
};

$serverConfig = ServerConfig::create()
    ->setFieldResolver(new DirectiveResolver($resolver));
```

Declare the directives and scalars you wish to use in your schema, and call them where desired:

```
directive @uppercase on FIELD_DEFINITION

scalar Email

type User {
    email: Email! @uppercase
}

type Query {
    user: User!
}
```

Jetpack Scalars
---------------

[](#jetpack-scalars)

You can use the provided Scalars just like any other type in your schema definition.

### scalar BigInt

[](#scalar-bigint)

An arbitrarily long sequence of digits that represents a big integer.

### scalar Date

[](#scalar-date)

A date string with format `Y-m-d`, e.g. `2011-05-23`.

The following conversion applies to all date scalars:

- Outgoing values can either be valid date strings or `\DateTimeInterface` instances.
- Incoming values must always be valid date strings and will be converted to `\DateTimeImmutable` instances.

### scalar DateTime

[](#scalar-datetime)

A datetime string with format `Y-m-d H:i:s`, e.g. `2018-05-23 13:43:32`.

### scalar DateTimeTz

[](#scalar-datetimetz)

A datetime string with format `Y-m-d\TH:i:s.uP`, e.g. `2020-04-20T16:20:04+04:00`, `2020-04-20T16:20:04Z`.

### scalar Email

[](#scalar-email)

A [RFC 5321](https://tools.ietf.org/html/rfc5321) compliant email.

### scalar JSON

[](#scalar-json)

Arbitrary data encoded in JavaScript Object Notation. See .

This expects a string in JSON format, not a GraphQL literal.

```
type Query {
  foo(bar: JSON!): JSON!
}

# Wrong, the given value is a GraphQL literal object
{
  foo(bar: { baz: 2 })
}

# Correct, the given value is a JSON string representing an object
{
  foo(bar: "{ \"bar\": 2 }")
}
```

JSON responses will contain nested JSON strings.

```
{
  "data": {
    "foo": "{ \"bar\": 2 }"
  }
}
```

### scalar Latitude

[](#scalar-latitude)

Any number between -90 and 90 degrees.

### scalar Longitude

[](#scalar-longitude)

Any number between -180 and 180 degrees.

### scalar Mixed

[](#scalar-mixed)

Loose type that allows any value. Be careful when passing in large `Int` or `Float` literals, as they may not be parsed correctly on the server side. Use `String` literals if you are dealing with really large numbers to be on the safe side.

### scalar Null

[](#scalar-null)

Always `null`. Strictly validates value is non-null, no coercion.

### scalar UsState

[](#scalar-usstate)

Any valid two-character US State abbreviation.

### scalar UsZipCode

[](#scalar-uszipcode)

Five digits, optionally followed by a dash and four additional digits.

Jetpack Directives
------------------

[](#jetpack-directives)

### directive @callback(fn: String!) on FIELD\_DEFINITION

[](#directive-callbackfn-string-on-field_definition)

Execute a function on the resolved value

### directive @lowercase on FIELD\_DEFINITION

[](#directive-lowercase-on-field_definition)

Transform resolved text lowercase

### directive @uppercase on FIELD\_DEFINITION

[](#directive-uppercase-on-field_definition)

Transform resolved text uppercase

License
-------

[](#license)

MIT License

###  Health Score

35

—

LowBetter than 80% of packages

Maintenance42

Moderate activity, may be stable

Popularity25

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 81.8% 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 ~45 days

Recently: every ~90 days

Total

9

Last Release

473d ago

Major Versions

v1.0.0 → v2.0.02024-02-01

PHP version history (2 changes)v1.0.0PHP ^7.4 || ^8

v2.3.0PHP ^7.4 || ^8.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/138688?v=4)[Jonathon Hill](/maintainers/compwright)[@compwright](https://github.com/compwright)

---

Top Contributors

[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (9 commits)")[![compwright](https://avatars.githubusercontent.com/u/138688?v=4)](https://github.com/compwright "compwright (2 commits)")

---

Tags

directivegraphqlgraphql-phpscalarphpgraphqlscalardirective

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/compwright-graphql-php-jetpack/health.svg)

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

###  Alternatives

[algolia/algoliasearch-client-php

API powering the features of Algolia.

69433.0M114](/packages/algolia-algoliasearch-client-php)[rubix/server

Deploy your Rubix ML models to production with scalable stand-alone inference servers.

632.3k](/packages/rubix-server)[thecodingmachine/graphqlite

Write your GraphQL queries in simple to write controllers (using webonyx/graphql-php).

5723.1M30](/packages/thecodingmachine-graphqlite)[theodo-group/llphant

LLPhant is a library to help you build Generative AI applications.

1.5k311.5k5](/packages/theodo-group-llphant)[comgate/sdk

Comgate PHP SDK

13327.8k](/packages/comgate-sdk)

PHPackages © 2026

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