These are the instructions on how to set-up a local development environment.
- PHP 8.0+
- Composer
- Lando 3.0.26+
Lando is a Docker-based tool. It is used to spin the webserver for development, providing:
- WordPress installed
- the GraphQL API plugin installed and activated
- symlinking to the source code
Clone the monorepo:
git clone https://github.com/leoloso/PoP.git
Install the dependencies, via Composer:
$ cd PoP
$ composer install
Build the Lando webserver:
composer build-server
The site will be available under http://graphql-api.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 GRAPHQL_API_DISABLE_CACHING
in wp-config.php
to true
:
define( 'GRAPHQL_API_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
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