Need help with graphql-api-for-wp?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

GraphQLAPI
134 Stars 5 Forks GNU General Public License v2.0 2.1K Commits 44 Opened issues

Description

[READ ONLY] GraphQL API for WordPress

Services available

!
?

Need anything else?

Contributors list

GraphQL API for WordPress

Transform your WordPress site into a modern GraphQL server: graphql-api.com.

The interactive schema visualizer

This plugin is the implementation for WordPress of GraphQL by PoP, a CMS-agnostic GraphQL server in PHP.

Requirements

  • WordPress 5.4 or above
  • PHP 7.4+ for development
  • PHP 7.1+ for production

Install

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.

Upload

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

Timeout in Nginx?

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
300
seconds in the Nginx config, as explained here.

Composer

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"
            ]
        }
    }
}

WP-CLI

To install via WP-CLI, execute this command:

wp plugin install --activate https://github.com/leoloso/PoP/releases/latest/download/graphql-api.zip

GitHub Updater

This plugin support automatic updating via the GitHub Updater.

Development

The source code is hosted on the PoP monorepo, under

GraphQLAPIForWP/plugins/graphql-api-for-wp
.

To set it up:

  1. Clone the monorepo:
git clone https://github.com/leoloso/PoP.git && cd PoP
  1. Install Composer dependencies:
cd layers/GraphQLAPIForWP/plugins/graphql-api-for-wp && composer install

Using Lando

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:

  • User:
    admin
  • Password:
    admin

Enable XDebug

To enable debugging, create Lando config file

.lando.local.yml
with this content:
config:
  xdebug: true

And then rebuild the server:

composer rebuild-server

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.