PHPackages                             efabrica/graphql - 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. efabrica/graphql

ActiveLibrary[API Development](/categories/api)

efabrica/graphql
================

GraphQL API server.

0.2.3(2y ago)349.7k↓25%11MITPHPPHP ^7.4|^8.0

Since Oct 24Pushed 2y ago4 watchersCompare

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

READMEChangelog (5)Dependencies (3)Versions (6)Used By (1)

GraphQL
=======

[](#graphql)

This package is using [webonyx/graphql-php](https://github.com/webonyx/graphql-php) as GraphQL driver and is meant to be used as automatic schema definition loader. For better understandation please reffer to [efabrica/nette-graphql](https://github.com/efabrica-team/nette-graphql) implementation of this package.

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

[](#installation)

Via composer

```
composer require efabrica/graphql
```

Usage
-----

[](#usage)

### Schema definition

[](#schema-definition)

```
use Efabrica\GraphQL\Resolvers\ResolverInterface;
use Efabrica\GraphQL\Schema\Definition\Arguments\FieldArgument;
use Efabrica\GraphQL\Schema\Definition\Fields\Field;
use Efabrica\GraphQL\Schema\Definition\Fields\InputObjectField;
use Efabrica\GraphQL\Schema\Definition\ResolveInfo;
use Efabrica\GraphQL\Schema\Definition\Schema;
use Efabrica\GraphQL\Schema\Definition\Types\InputObjectType;
use Efabrica\GraphQL\Schema\Definition\Types\ObjectType;
use Efabrica\GraphQL\Schema\Definition\Types\Scalar\IDType;
use Efabrica\GraphQL\Schema\Definition\Types\Scalar\IntType;
use Efabrica\GraphQL\Schema\Definition\Types\Scalar\StringType;

$userResolver = new class implements ResolverInterface {
    public function __invoke($parentValue, array $args, ResolveInfo $resolveInfo): array
    {
        $limit = $args['pagination']['limit'] ?? null;
        $offset = $args['pagination']['offset'] ?? 0;

        $users = [
            [
                'id' => 1,
                'name' => 'John Doe',
                'email' => 'john@doe.com',
            ],
            [
                'id' => 2,
                'name' => 'Jane Dane',
                'email' => 'jane@dane.com',
            ],
            [
                'id' => 3,
                'name' => 'Moe Lester',
                'email' => 'moe@lester.com',
            ],
        ];

        return array_slice($users, $offset, $limit);
    }
};

$userObjectType = (new ObjectType('User'))
    ->setFields([
        new Field('id', new IDType()),
        new Field('name', new StringType()),
        new Field('email', new StringType()),
    ]);

$paginationArgument = new FieldArgument(
    'pagination',
    (new InputObjectType('pagination_argument'))
        ->setFields([
            (new InputObjectField('limit', new IntType()))
                ->setNullable(),
            (new InputObjectField('offset', new IntType()))
                ->setNullable(),
        ])
);

$schema = (new Schema())
    ->setQuery(
        (new ObjectType('Query'))
            ->setFields([
                (new Field('Users', $userObjectType))
                    ->setMulti()
                    ->setArguments([
                        $paginationArgument,
                    ])
                    ->setResolver($userResolver),
            ])
    );
```

### Initialization

[](#initialization)

```
use Efabrica\GraphQL\Drivers\WebonyxDriver;
use Efabrica\GraphQL\GraphQL;
use Efabrica\GraphQL\Schema\Loaders\DefinitionSchemaLoader;

$schemaLoader = new DefinitionSchemaLoader($schema);
$driver = new WebonyxDriver($schemaLoader);
$graphql = new GraphQL($driver);
```

### Fetching results

[](#fetching-results)

```
$query =
//    array(3) {
//      'id' =>
//      string(1) "2"
//      'name' =>
//      string(9) "Jane Dane"
//      'email' =>
//      string(13) "jane@dane.com"
//    }
//    [1] =>
//    array(3) {
//      'id' =>
//      string(1) "3"
//      'name' =>
//      string(10) "Moe Lester"
//      'email' =>
//      string(14) "moe@lester.com"
//    }
//  }
//}
```

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity33

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity45

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 91.7% 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 ~122 days

Total

5

Last Release

810d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/25289c62a88df1c404543693ba52e44748dbce486bcfab91fc8c5931a6bb38e1?d=identicon)[dev-efabrica](/maintainers/dev-efabrica)

---

Top Contributors

[![MartinPetricko](https://avatars.githubusercontent.com/u/39132866?v=4)](https://github.com/MartinPetricko "MartinPetricko (11 commits)")[![calvera](https://avatars.githubusercontent.com/u/432090?v=4)](https://github.com/calvera "calvera (1 commits)")

---

Tags

phpapigraphql

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/efabrica-graphql/health.svg)

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

###  Alternatives

[mll-lab/graphql-php-scalars

A collection of custom scalar types for usage with https://github.com/webonyx/graphql-php

1394.2M28](/packages/mll-lab-graphql-php-scalars)[ivome/graphql-relay-php

A PHP port of GraphQL Relay reference implementation

271632.4k5](/packages/ivome-graphql-relay-php)[rubix/server

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

632.3k](/packages/rubix-server)

PHPackages © 2026

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