PHPackages                             x-graphql/http-schema - 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. x-graphql/http-schema

ActiveLibrary[API Development](/categories/api)

x-graphql/http-schema
=====================

Building GraphQL schema over HTTP (aka remote schema)

0.9.0(2y ago)139.4k↓27.7%2MITPHPPHP &gt;=8.2

Since Feb 16Pushed 2y agoCompare

[ Source](https://github.com/x-graphql/http-schema)[ Packagist](https://packagist.org/packages/x-graphql/http-schema)[ RSS](/packages/x-graphql-http-schema/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (14)Versions (13)Used By (2)

HTTP Schema
===========

[](#http-schema)

[![unit tests](https://github.com/x-graphql/http-schema/actions/workflows/unit_tests.yml/badge.svg)](https://github.com/x-graphql/http-schema/actions/workflows/unit_tests.yml/badge.svg)[![codecov](https://camo.githubusercontent.com/8124471f6cabc7f8f79c860cd532b4422dca35cbce3840db078f1ff71c3cdbf8/68747470733a2f2f636f6465636f762e696f2f67682f782d6772617068716c2f687474702d736368656d612f67726170682f62616467652e7376673f746f6b656e3d416c695a6b5854623445)](https://codecov.io/gh/x-graphql/http-schema)

Help to build and execute [GraphQL schema](https://webonyx.github.io/graphql-php/) over HTTP (aka remote schema).

Getting Started
---------------

[](#getting-started)

Install this package via [Composer](https://getcomposer.org)

```
composer require x-graphql/http-schema
```

This library require [PSR-18 Client](https://www.php-fig.org/psr/psr-18/) or [Httplug Async Client](https://docs.php-http.org/en/latest/index.html) for sending async requests. Run the command bellow if you don't have yet.

```
composer require php-http/guzzle7-adapter
```

Usages
------

[](#usages)

This library offers to you 2 strategy to build schema:

- Build from schema definition language (SDL), this strategy use for limiting fields user can access.
- Build from introspection query, with this strategy it will make a http request for [introspecting schema](https://graphql.org/learn/introspection/), user can access all the fields.

### From SDL

[](#from-sdl)

```
use GraphQL\GraphQL;
use XGraphQL\HttpSchema\HttpDelegator;
use XGraphQL\HttpSchema\HttpSchemaFactory;

$delegator = new HttpDelegator('https://countries.trevorblades.com/');
$schema = HttpSchemaFactory::createFromSDL(
$delegator,
toArray());
```

### From introspection query

[](#from-introspection-query)

```
use GraphQL\GraphQL;
use XGraphQL\HttpSchema\HttpDelegator;
use XGraphQL\HttpSchema\HttpSchemaFactory;

$delegator = new HttpDelegator('https://countries.trevorblades.com/');
$schema = HttpSchemaFactory::createFromIntrospectionQuery($delegator);
$result = GraphQL::executeQuery($schema, 'query { countries { name } }');

var_dump($result->toArray());
```

### Caching schema

[](#caching-schema)

For optimizing time to build schema from SDL or introspection query, you can put [PSR-16](https://www.php-fig.org/psr/psr-16/) instance to factory methods for caching schema after built:

```
use XGraphQL\HttpSchema\HttpDelegator;
use XGraphQL\HttpSchema\HttpSchemaFactory;

/// $psr16Cache = ....
$delegator = new HttpDelegator('https://countries.trevorblades.com/');
$schemaFromSDL = HttpSchemaFactory::createFromSDL($delegator, /// $sdl, $psr16Cache);
$schemaFromIntrospection = HttpSchemaFactory::createFromIntrospectionQuery($delegator, /// $psr16Cache);

/// ........
```

Credits
-------

[](#credits)

Created by [Minh Vuong](https://github.com/vuongxuongminh)

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity30

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity51

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~5 days

Total

12

Last Release

769d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/8901d64a1059726b851dbdd91463ad1d3169f9dba6a2dcff11d05f97d9bccaea?d=identicon)[vuongxuongminh](/maintainers/vuongxuongminh)

---

Top Contributors

[![vuongxuongminh](https://avatars.githubusercontent.com/u/38932626?v=4)](https://github.com/vuongxuongminh "vuongxuongminh (46 commits)")

###  Code Quality

TestsPHPUnit

Code StyleECS

### Embed Badge

![Health badge](/badges/x-graphql-http-schema/health.svg)

```
[![Health](https://phpackages.com/badges/x-graphql-http-schema/health.svg)](https://phpackages.com/packages/x-graphql-http-schema)
```

###  Alternatives

[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.4k5.6M651](/packages/sylius-sylius)[wordpress/php-ai-client

A provider agnostic PHP AI client SDK to communicate with any generative AI models of various capabilities using a uniform API.

26236.6k14](/packages/wordpress-php-ai-client)[getbrevo/brevo-php

Official Brevo provided RESTFul API V3 php library

963.1M35](/packages/getbrevo-brevo-php)[swisnl/json-api-client

A PHP package for mapping remote JSON:API resources to Eloquent like models and collections.

211473.2k12](/packages/swisnl-json-api-client)[phpro/http-tools

HTTP tools for developing more consistent HTTP implementations.

28137.8k](/packages/phpro-http-tools)[trycourier/courier

Courier PHP SDK

16643.9k](/packages/trycourier-courier)

PHPackages © 2026

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