Gato GraphQL is a tool for interacting with data in your WordPress site. You can think of it as a Swiss Army knife for dealing with data, as it allows to retrieve, manipulate and store again any piece of data, in any desired way, using the GraphQL language.
With Gato GraphQL, you can:
- Query data to create headless sites
- Expose public and private APIs
- Map JS components to Gutenberg blocks
- Synchronize content across sites
- Automate tasks
- Complement WP-CLI to execute admin tasks
- Search/replace content for site migrations
- Send notifications when something happens (new post published, new comment added, etc)
- Interact with cloud services
- Convert the data from a 3rd-party API into the required format
- Translate content in the site
- Update thousands of posts with a single action
- Insert or remove Gutenberg blocks in bulk
- Validate that a new post contains a mandatory block
- And much more...
Check out the Recipes section in gatographql.com which demonstrates how to implement these use cases using the plugin.
GraphiQL client to execute queries in the wp-admin:
Interactively browse the GraphQL schema, exploring all connections among entities:
The GraphiQL client for the single endpoint is exposed to the Internet:
Interactively browse the GraphQL schema exposed for the single endpoint:
Persisted queries are pre-defined and stored in the server:
Requesting a persisted query URL will retrieve its pre-defined GraphQL response:
We can create multiple custom endpoints, each for a different target:
Endpoints are configured via Schema Configurations:
We can create many Schema Configurations, customizing them for different users or applications:
Custom endpoints and Persisted queries can be public, private and password-protected:
Manage custom endpoints and persisted queries by adding categories to them:
We can configure exactly what custom post types, options and meta keys can be queried:
Configure every aspect from the plugin via the Settings page:
Modules with different functionalities and schema extensions can be enabled and disabled:
Augment the plugin functionality and GraphQL schema via extensions:
The Recipes section contains example queries ready to copy/paste and use:
For alternative installation methods, check Installing Gato GraphQL.
Download the latest release of the plugin as a .zip file.
Then, in the WordPress admin:
- Go to
Plugins => Add New
- Click on
Upload Plugin
- Select the .zip file
- Click on
Install Now
(it may take a few minutes) - Once installed, click on
Activate
Requirements:
- WordPress 5.4+
- PHP 7.2+
Check the list of Supported PHP features.
Compiled JavaScript code (such as all files under a block's build/
folder) is added to the repo, but only as compiled for production, i.e. after running npm run build
.
Code compiled for development, i.e. after running npm start
, cannot be commited/pushed to the repo.
Architectural resources
Articles explaining how the plugin is "downgraded", using PHP 8.1 for development but deployable to PHP 7.2 for production:
- Transpiling PHP code from 8.0 to 7.x via Rector
- Coding in PHP 7.4 and deploying to 7.1 via Rector and GitHub Actions
- Tips for transpiling code from PHP 8.0 down to 7.1
- Including both PHP 7.1 and 8.0 code in the same plugin … or not?
Service container implementation:
Explanation of how the codebase is split into granular packages, to enable CMS-agnosticism:
- Abstracting WordPress Code To Reuse With Other CMSs: Concepts (Part 1)
- Abstracting WordPress Code To Reuse With Other CMSs: Implementation (Part 2)
Description of how the plugin is scoped:
Gato GraphQL is powered by the CMS-agnostic GraphQL server GraphQL by PoP.
Technical information on how the GraphQL server works:
Description of how a GraphQL server using server-side components works:
These articles explain the concepts, design and implementation of GraphQL by PoP:
- Designing a GraphQL server for optimal performance
- Simplifying the GraphQL data model
- Schema-first vs code-first development in GraphQL
- Speeding-up changes to the GraphQL schema
- Versioning fields in GraphQL
- GraphQL directives are underrated
- Treating GraphQL directives as middleware
- Creating an @export GraphQL directive
- Adding directives to the schema in code-first GraphQL servers
- Coding a GraphQL server in JavaScript vs. WordPress
- Supporting opt-in nested mutations in GraphQL
- HTTP caching in GraphQL
These articles explain the integration with Gutenberg (the WordPress editor).
GatoGraphQL/GatoGraphQL
is a monorepo containing the several layers required for Gato GraphQL. Check Monorepo_README.md for documentation of the different projects.
To check the coding standards via PHP CodeSniffer, run:
composer check-style
To automatically fix issues, run:
composer fix-style
Please see CHANGELOG for more information on what has changed recently.
To execute PHPUnit, run:
composer test
To execute PHPStan, run:
composer analyse
To visualize how Rector will downgrade the code to PHP 7.2:
composer preview-code-downgrade
To report a bug or request a new feature please do it on the GatoGraphQL monorepo issue tracker.
We welcome contributions for this package on the GatoGraphQL monorepo (where the source code for this package is hosted).
Please see CONTRIBUTING and CODE_OF_CONDUCT for details.
If you discover any security related issues, please email leo@getpop.org instead of using the issue tracker.
GPLv2 or later. Please see License File for more information.