Skip to content

Latest commit

 

History

History
112 lines (72 loc) · 2.51 KB

development-environment.md

File metadata and controls

112 lines (72 loc) · 2.51 KB

Setting-up the development environment

These are the instructions on how to set-up a local development environment.

Requirements

  • PHP 8.1+
  • Composer
  • Lando 3.0.26+

Lando is a Docker-based tool. It is used to spin the webserver for development, providing:

  • WordPress installed
  • Gato GraphQL installed and activated
  • symlinking to the source code

Install

Clone the monorepo:

git clone https://github.com/GatoGraphQL/GatoGraphQL.git

Install the dependencies, via Composer:

$ cd PoP
$ composer install

Build the Lando webserver:

composer build-server

If the process throws an error before installing the WordPress site (it may happen due to unidentified reasons), then run:

composer install-site

To re-install the WordPress DB with the initial set of data (needed for running integration tests), run:

composer reset-db

Site URL

The site will be available under https://gatographql.lndo.site.

To access the wp-admin:

  • User: admin
  • Password: admin

Starting the Lando webserver

To start the server, execute:

composer start-server

Caching

By default, the webserver will have global caching enabled.

To test a change during development, we must manually purge the cache (recommended option to keep the GraphQL server running fast), or directly disable caching.

Purging the cache

Cached files are stored under the plugin's cache subfolder.

To purge them, simply delete this folder, or execute the following Composer script:

composer purge-cache

Disable caching

Caching is disabled by setting constant GATOGRAPHQL_DISABLE_CACHING in wp-config.php to true:

define( 'GATOGRAPHQL_DISABLE_CACHING', 'true' );

To define this constant, we can execute the following Composer scripts:

$ composer disable-caching
$ composer enable-caching

Debugging

XDebug is enabled by default, but must be triggered for the specific request. To do so, append param XDEBUG_TRIGGER=1 to the URL:

  • In the wp-admin, in the URL to load the GraphiQL or Interactive schema client
  • In the URL of any public client, such as the GraphiQL or Interactive schema client attached to:
    • the public single endpoint
    • a custom endpoint
  • To any custom endpoint
  • To any persisted query

Additional resources