These are the instructions on how to set-up a local development environment.
- 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
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
The site will be available under https://gatographql.lndo.site
.
To access the wp-admin:
- User:
admin
- Password:
admin
To start the server, execute:
composer start-server
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.
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
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
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