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

ActiveCakephp-plugin[API Development](/categories/api)

reydajp/cake-graphql
====================

GraphQL endpoint plugin for CakePHP 5 using GraphQLite and Webonyx GraphQL PHP.

v1.1.1(2w ago)04↓100%MITPHPPHP &gt;=8.3CI passing

Since May 23Pushed 2w agoCompare

[ Source](https://github.com/reydajp/cakephp-graphql-plugin)[ Packagist](https://packagist.org/packages/reydajp/cake-graphql)[ RSS](/packages/reydajp-cake-graphql/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (3)Dependencies (4)Versions (5)Used By (0)

[![CI](https://github.com/reydajp/cakephp-graphql-plugin/actions/workflows/ci.yml/badge.svg?branch=dev)](https://github.com/reydajp/cakephp-graphql-plugin/actions/workflows/ci.yml?query=branch%3Adev)[![Coverage](https://camo.githubusercontent.com/b64e9e8f4d9fa4c8dc9b0abcf92bbaf2477055394140f147313432209aa6537e/68747470733a2f2f636f6465636f762e696f2f67682f72657964616a702f63616b657068702d6772617068716c2d706c7567696e2f6272616e63682f6465762f67726170682f62616467652e737667)](https://codecov.io/gh/reydajp/cakephp-graphql-plugin)[![Packagist](https://camo.githubusercontent.com/da70a65a88963b1bd669fda7e120bb7e0baf8885e7a3fbf28c3455802d67ce61/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f72657964616a702f63616b652d6772617068716c2e737667)](https://packagist.org/packages/reydajp/cake-graphql)[![PHP](https://camo.githubusercontent.com/ecbf012e3704aed80a710e072f8a2b65afb62dddc90cadf159926d8678d54888/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d253345253344382e332d3737374242342e737667)](https://www.php.net/)[![License: MIT](https://camo.githubusercontent.com/7013272bd27ece47364536a221edb554cd69683b68a46fc0ee96881174c4214c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c75652e737667)](LICENSE)

CakeGraphQL
===========

[](#cakegraphql)

CakeGraphQL is a CakePHP 5 plugin for GraphQL endpoint routing, endpoint-level authentication, engine selection, and GraphQLite integration.

The plugin owns the HTTP endpoint and GraphQL engine wiring. The host application owns resolver classes, entity/type annotations, authentication provider setup, field-level authorization, and business logic.

Requirements
------------

[](#requirements)

- PHP 8.3 or newer
- CakePHP 5
- GraphQLite 8
- Webonyx GraphQL PHP 15

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

[](#installation)

```
composer require reydajp/cake-graphql
```

Load the plugin in the host application:

```
// src/Application.php
public function bootstrap(): void
{
    parent::bootstrap();

    $this->addPlugin('CakeGraphQL');
}
```

Configuration
-------------

[](#configuration)

Configure the plugin with the `Graphql` key:

```
// config/app_local.php or config/app.php
'Graphql' => [
    'path' => '/api/graphql',
    'engine' => 'Graphqlite',
    'authenticated' => true,
    'engines' => [
        'Graphqlite' => [
            'queries' => [
                App\Graphql\UsersQuery::class,
            ],
            'types' => [
                App\Model\Entity\User::class,
            ],
            'cache' => 'default',
            'debug' => false,
            'maxDepth' => 10,
            'maxComplexity' => 200,
        ],
    ],
],
```

The plugin registers the configured route and attaches route-specific GraphQL middleware. CakePHP routing middleware must run as usual in the host application. `maxDepth` and `maxComplexity` reject overly nested or expensive GraphQL operations before resolver execution.

See [docs/configuration.md](docs/configuration.md) for the full configuration contract.

Resolver Example
----------------

[](#resolver-example)

```
