From 578bfc264460d46f1003b5236c3719d75ce10952 Mon Sep 17 00:00:00 2001 From: tyler36 Date: Fri, 19 Jul 2024 08:59:31 +0900 Subject: [PATCH] docs: add CakePHP docs (#36) * docs: sort framework configurations * docs: add CakePHP docs --------- Co-authored-by: tyler36 <7234392+tyler36@users.noreply.github.com> --- README.md | 65 ++++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 45 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index 5682542..714ac7a 100644 --- a/README.md +++ b/README.md @@ -6,9 +6,10 @@ - [Warning](#warning) - [Getting started](#getting-started) - [Framework configuration](#framework-configuration) + - [CakePHP](#cakephp) - [Drupal](#drupal) - - [WordPress](#wordpress) - [Silverstripe](#silverstripe) + - [WordPress](#wordpress) - [Usage](#usage) - [Configuration](#configuration) @@ -36,7 +37,7 @@ Profiling in a production environment is not recommended. ## Framework configuration -### Drupal +### CakePHP - Install `perftools/php-profiler` @@ -44,44 +45,39 @@ Profiling in a production environment is not recommended. ddev composer require perftools/php-profiler --dev ``` -- Add the following line to `web/sites/default/settings.php` to include the collector. +- Add the following line to `src/Application.php` to include the collector. ```php - if (file_exists("/mnt/ddev_config/xhgui/collector/xhgui.collector.php")) { - require_once "/mnt/ddev_config/xhgui/collector/xhgui.collector.php"; - } + public function bootstrap(): void + { + parent::bootstrap(); + + // Below is the new code to add + if (file_exists("/mnt/ddev_config/xhgui/collector/xhgui.collector.php")) { + require_once "/mnt/ddev_config/xhgui/collector/xhgui.collector.php"; + } ``` - Run `ddev xhprof` to start profiling. - XHGui is now available at `https://yourproject.ddev.site:8142` -### WordPress +### Drupal - Install `perftools/php-profiler` - - If using [bedrock](https://roots.io/bedrock/) ```shell ddev composer require perftools/php-profiler --dev ``` - - If using vanilla WordPress: - - ```shell - wget https://github.com/perftools/php-profiler/archive/refs/tags/0.18.0.tar.gz - tar -xvf 0.18.0.tar.gz - ``` - -- Add the following line to `wp-config-ddev.php` to include the collector. +- Add the following line to `web/sites/default/settings.php` to include the collector. ```php - require_once __DIR__ . '/php-profiler-0.18.0/autoload.php'; if (file_exists("/mnt/ddev_config/xhgui/collector/xhgui.collector.php")) { - require_once "/mnt/ddev_config/xhgui/collector/xhgui.collector.php"; + require_once "/mnt/ddev_config/xhgui/collector/xhgui.collector.php"; } ``` -- Remove `#ddev-generated` from `wp-config-ddev.php` to prevent DDEV overriding it. -- Run `ddev xhprof` to start profiling +- Run `ddev xhprof` to start profiling. - XHGui is now available at `https://yourproject.ddev.site:8142` ### Silverstripe @@ -112,6 +108,35 @@ Profiling in a production environment is not recommended. - Run `ddev xhprof` to start profiling - XHGui is now available at `https://yourproject.ddev.site:8142` +### WordPress + +- Install `perftools/php-profiler` + - If using [bedrock](https://roots.io/bedrock/) + + ```shell + ddev composer require perftools/php-profiler --dev + ``` + + - If using vanilla WordPress: + + ```shell + wget https://github.com/perftools/php-profiler/archive/refs/tags/0.18.0.tar.gz + tar -xvf 0.18.0.tar.gz + ``` + +- Add the following line to `wp-config-ddev.php` to include the collector. + + ```php + require_once __DIR__ . '/php-profiler-0.18.0/autoload.php'; + if (file_exists("/mnt/ddev_config/xhgui/collector/xhgui.collector.php")) { + require_once "/mnt/ddev_config/xhgui/collector/xhgui.collector.php"; + } + ``` + +- Remove `#ddev-generated` from `wp-config-ddev.php` to prevent DDEV overriding it. +- Run `ddev xhprof` to start profiling + - XHGui is now available at `https://yourproject.ddev.site:8142` + ## Usage The service will automatically start when run: `ddev start` or `ddev restart`.