PHPackages                             wedrix/watchtower - 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. wedrix/watchtower

ActiveLibrary[API Development](/categories/api)

wedrix/watchtower
=================

A wrapper around graphql-php for serving GraphQL from Doctrine-based frameworks like Symfony.

v10.0.1(3mo ago)23141MITPHPPHP ^8.0CI passing

Since Dec 19Pushed 3mo ago1 watchersCompare

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

READMEChangelog (10)Dependencies (7)Versions (47)Used By (1)

An auto-generation library that eliminates boilerplate by automatically building production-ready GraphQL APIs from [Doctrine ORM](https://github.com/doctrine/orm) entities. Built on [graphql-php](https://github.com/webonyx/graphql-php), it provides out-of-the-box support for queries, mutations, filtering, pagination, and authorization — perfect for [Symfony](https://symfony.com) and other Doctrine-based frameworks.

Table of Contents
=================

[](#table-of-contents)

- [Features](#features)
- [Motivation](#motivation)
- [Requirements](#requirements)
- [Installation](#installation)
- [Running Tests](#running-tests)
- [Demo Application](#demo-application)
- [Usage](#usage)
- [Schema](#schema)
- [Querying](#querying)
- [Plugins](#plugins)
- [Computed Fields](#computed-fields)
- [Filtering](#filtering)
- [Ordering](#ordering)
- [Mutations](#mutations)
- [Subscriptions](#subscriptions)
- [Authorizors](#authorizors)
- [Performance Optimization](#performance-optimization)
- [Security](#security)
- [Known Issues](#known-issues)
- [Versioning](#versioning)
- [Contributing](#contributing)
- [Reporting Vulnerabilities](#reporting-vulnerabilities)
- [License](#license)

Features
========

[](#features)

- **SDL-First Approach** — Define your GraphQL schema using the Schema Definition Language for clarity and maintainability.
- **Automatic Pagination** — Out-of-the-box pagination support for queries and collections without extra boilerplate.
- **Extensible Plugin System** — Implement computed fields, custom filtering, ordering, mutations, subscriptions, authorization, and custom resolvers through an intuitive plugin architecture.
- **Complete Type System Support** — Full support for enums, abstract types (Unions and Interfaces), custom scalars, custom directives, and more.
- **Schema Auto-Generation** — Automatically generate initial GraphQL schemas from your Doctrine ORM entities and update them as your models evolve.
- **Code Generation Tools** — CLI commands to auto-generate plugin boilerplate and scalar type definitions, speeding up development.
- **Performance-Optimized Batching** — Automatic query batching and support for mutation/resolver batching to eliminate the N+1 problem and reduce database load.

Motivation
==========

[](#motivation)

Building GraphQL APIs typically requires writing extensive boilerplate code: schema definitions, resolvers for queries and mutations, pagination logic, filtering, authorization checks, and more. This repetitive work is time-consuming and error-prone, diverting your focus from implementing your API's unique business logic.

Watchtower changes this by **automatically generating your entire GraphQL API from your existing Doctrine ORM models**. Using your existing Doctrine annotations, Watchtower generates a GraphQL SDL schema and provides a complete, production-ready GraphQL API with full querying, filtering, pagination, and authorization capabilities—eliminating months of routine development.

This library draws inspiration from similar code-generation approaches on other platforms:

- **[Lighthouse](https://github.com/nuwave/lighthouse)** for Laravel and Eloquent
- **[Mongoose GraphQL Server](https://github.com/DanishSiraj/mongoose-graphql-server)** for Express and Mongoose

These projects have proven the immense value of automatically generating GraphQL servers. Watchtower brings the same philosophy to the PHP/Doctrine ecosystem.

Requirements
============

[](#requirements)

- php &gt;= v8.0
- doctrine/orm ^2.8 || ^3.0
- webonyx/graphql-php ^15.30.2

Installation
============

[](#installation)

```
composer require wedrix/watchtower

```

Running Tests
=============

[](#running-tests)

The project includes an integration-focused test suite for the `Console` and `Executor` entry points.

Run all tests:

```
composer test

```

Run grouped workflows:

```
composer test:console
composer test:executor

```

Run Doctrine compatibility lanes locally (lowest/latest for each supported major):

```
composer test:doctrine2:lowest
composer test:doctrine2:latest
composer test:doctrine3:lowest
composer test:doctrine3:latest

```

Run the full local matrix:

```
composer test:matrix

```

Run static checks:

```
composer lint:check
composer rector:check
composer phpstan:check

```

Symfony Compatibility
---------------------

[](#symfony-compatibility)

Watchtower has no direct dependency on Symfony. Compatibility is determined by your application's PHP + Doctrine ORM stack.

- Minimum Watchtower baseline: PHP 8.0 + Doctrine ORM 2.8
- Doctrine ORM 3.x requires PHP 8.1+
- In practice, this means Symfony `5.4+` can work when your Symfony/Doctrine bridge versions match those constraints.

If you use Symfony, use a Symfony release that supports your PHP version and Doctrine integration.
As of February 13, 2026, Symfony's maintained branches are `6.4`, `7.4`, and `8.0`: .

Symfony Bundle
--------------

[](#symfony-bundle)

The documentation for the Symfony bundle is available [here](https://github.com/Wedrix/watchtower-symfony-bundle). Kindly view it for the appropriate installation steps for Symfony.

Demo Application
----------------

[](#demo-application)

The demo application, written for Symfony, allows you to test out the various features of this package. The documentation is available [here](https://github.com/Wedrix/watchtower-symfony-demo-application).

Usage
=====

[](#usage)

This library is composed of two main components:

1. The Executor component `Wedrix\Watchtower\Executor`, responsible for auto-resolving queries.
2. The Console component `Wedrix\Watchtower\Console`, responsible for code generation, schema management, and plugin management.

The Executor component should be used in some controller class or callback function to power your service's GraphQL endpoint. The example usage below is for a Slim 4 application:

```
#index.php
