From 427f51cfeb492560e3b8e9c5d65ca15dbc4671df Mon Sep 17 00:00:00 2001 From: Simon Erkelens Date: Tue, 7 Nov 2023 14:16:01 +1300 Subject: [PATCH] Add Silverstripe instructions to readme (#7) --- README.md | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/README.md b/README.md index 256196a..4f476d8 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,7 @@ - [Framework configuration](#framework-configuration) - [Drupal 8+](#drupal-8) - [Wordpress](#wordpress) + - [Silverstripe](#silverstripe) - [Usage](#usage) ## Introduction @@ -79,6 +80,30 @@ If you want to stop profiling, you can just comment/remove those lines. Take into account that with the default configuration, every time you `ddev start`, DDEV will recreate this file. You can remove the `#ddev-generated` at the top of the file if you want to avoid that. +### Silverstripe + +Add/install `perftools/php-profiler`, as per [getting started](#getting-started) + +- Copy the files from `.ddev/xhgui/examples` folder to your `public` folder (`cp .ddev/xhgui/examples/*.php public/`) +- Add the requirement to your `public/index.php`, right after the autoload includes: + ```php + if (file_exists(__DIR__ . '/../vendor/autoload.php')) { + require __DIR__ . '/../vendor/autoload.php'; + } elseif (file_exists(__DIR__ . '/vendor/autoload.php')) { + require __DIR__ . '/vendor/autoload.php'; + } else { + header('HTTP/1.1 500 Internal Server Error'); + echo "autoload.php not found"; + exit(1); + } + if (file_exists(__DIR__ . '/xhgui.collector.php')) { + require_once __DIR__ . '/xhgui.collector.php'; + } + ``` +- Run `ddev xhprof` to start profiling +- XHGui is now available at `yourproject.ddev.site`:8142 + + ## Usage The service will automatically start when run: `ddev start` or `ddev restart`.