[READ ONLY] GraphQL API for WordPress
Transform your WordPress site into a modern GraphQL server: graphql-api.com.
This plugin is the implementation for WordPress of GraphQL by PoP, a CMS-agnostic GraphQL server in PHP.
Ready for production?
This plugin requires 3rd party dependencies, but they have not been scoped yet (see issue #9). So please install this plugin in a development environment first, to make sure there are no conflicts with the other plugins installed in the site.
Download the latest release of the plugin as a .zip file.
Then, in the WordPress admin:
Plugins => Add New
Upload Plugin
Install Now(it may take a few minutes)
Activate
Nginx has a time limit to process the response from the PHP backend, and installing large WordPress plugins may exceed the default time limit.
If when installing the plugin you get a "504 Gateway Timeout" error, or an entry
"upstream timed out (110: Connection timed out) while reading upstream"in the log, increase the timeout to
300seconds in the Nginx config, as explained here.
Add the following configuration to your
composer.json:
{ "require": { "graphql-api/graphql-api-for-wp": "^0.7.11" }, "minimum-stability": "dev", "repositories": [ { "type": "package", "package": { "name": "graphql-api/graphql-api-for-wp", "type": "wordpress-plugin", "version": "0.7.11", "dist": { "url": "https://github.com/leoloso/PoP/releases/latest/download/graphql-api.zip", "type": "zip" }, "require": { "composer/installers": "^1" } } } ], "extra": { "installer-paths": { "wp-content/plugins/{$name}/": [ "type:wordpress-plugin" ] } } }
To install via WP-CLI, execute this command:
wp plugin install --activate https://github.com/leoloso/PoP/releases/latest/download/graphql-api.zip
This plugin support automatic updating via the GitHub Updater.
The source code is hosted on the PoP monorepo, under
GraphQLAPIForWP/plugins/graphql-api-for-wp.
To set it up:
git clone https://github.com/leoloso/PoP.git && cd PoP
cd layers/GraphQLAPIForWP/plugins/graphql-api-for-wp && composer install
Launch a development server, with WordPress installed and the GraphQL API plugin activated, through Lando.
The first time, to install the server, execute:
composer build-server
From then on, to start the server, execute:
composer start-server
The site will be available under
http://graphql-api-dev.lndo.site.
To access the wp-admin:
admin
admin
To enable debugging, create Lando config file
.lando.local.ymlwith this content:
config: xdebug: true
And then rebuild the server:
composer rebuild-server