Skip to content

Commit

Permalink
README: Remove configuration instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
rfay committed Jan 2, 2025
1 parent 4600247 commit 196d4a9
Showing 1 changed file with 8 additions and 178 deletions.
186 changes: 8 additions & 178 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,6 @@
- [Introduction](#introduction)
- [Warning](#warning)
- [Getting started](#getting-started)
- [Framework configuration](#framework-configuration)
- [CakePHP](#cakephp)
- [Drupal](#drupal)
- [Laravel](#laravel)
- [OpenMage](#openmage)
- [Silverstripe](#silverstripe)
- [WordPress](#wordpress)
- [Usage](#usage)
- [Configuration](#configuration)

Expand All @@ -30,194 +23,31 @@ Profiling in a production environment is not recommended.

## Getting started

- Install the `ddev-xhgui` add-on:
- Install the `ddev-xhgui` add-on and restart your project

For DDEV v1.23.5 or above run

```shell
ddev add-on get ddev/ddev-xhgui
```

For earlier versions of DDEV run

```shell
ddev get ddev/ddev-xhgui
```

Then restart your project

```shell
ddev restart
```

## Framework configuration

### CakePHP

- Install `perftools/php-profiler`

```shell
ddev composer require perftools/php-profiler --dev
```

- Add the following line to `src/Application.php` to include the 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`

### Drupal

- Install `perftools/php-profiler`

```shell
ddev composer require perftools/php-profiler --dev
```

- Add the following line to `web/sites/default/settings.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";
}
```

- Run `ddev xhprof` to start profiling.
- XHGui is now available at `https://yourproject.ddev.site:8142`

### Laravel

- Install `perftools/php-profiler`

```shell
ddev composer require perftools/php-profiler --dev
```

- Add the following line to `app/Providers/AppServiceProvider.php` to include the collector.

```php
public function boot(): void
{
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`

### OpenMage

- Install `perftools/php-profiler`

```shell
ddev composer require perftools/php-profiler --dev
```

- Add the following line to `app/Mage.php`, right after the "AUTOLOADER PATCH", 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";
}
```

- Run `ddev xhprof` to start profiling.
- XHGui is now available at `https://yourproject.ddev.site:8142`

### Silverstripe

- Install `perftools/php-profiler`

```shell
ddev composer require perftools/php-profiler --dev
```

- Add the following line to `public/index.php`, right after the autoload includes, to include the collector.

```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("/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

- Install `perftools/php-profiler`
- If using [bedrock](https://roots.io/bedrock/)

```shell
ddev composer require perftools/php-profiler --dev
```

- If using vanilla WordPress:

```shell
git clone https://github.com/perftools/php-profiler.git
```

- Add the following line to `wp-config-ddev.php` to include the collector.

```php
require_once __DIR__ . '/php-profiler/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`
```shell
ddev add-on get ddev/ddev-xhgui && ddev restart
```

## Usage

The service will automatically start when run: `ddev start` or `ddev restart`.
When you want to start profiling, `ddev xhprof on`.

By default, xhgui will be available at `https://yourproject.ddev.site:8143`.
Use the following command to launch the xhgui in your browser:

```shell
ddev xhgui
```
The web profiling UI is at `https://yourproject.ddev.site:8143` or use `ddev xhgui` to launch it.

For detailed information about a single request, click on the "Method" keyword on the "Recent runs" dashboard.

![Click GET method](./images/xhgui-get.png)

Remember, if you updated `settings.ddev.php` or `wp-config-ddev.php`, these file will be overwritten unless you remove the `#ddev-generated`.

Use the following command to check the logs:
To check the xhgui service's logs:

```shell
ddev logs -s xhgui
```

## Configuration

To configure Xhgui, update `.ddev/xhgui/xhgui.config.php`.
To configure Xhgui, add `.ddev/xhgui/xhgui.config.php`.

For example, to set xhgui to use `Asia/Toyko` timezone for dates:

Expand Down

0 comments on commit 196d4a9

Please sign in to comment.