Skip to content

Commit

Permalink
docs: add CakePHP docs (#36)
Browse files Browse the repository at this point in the history
* docs: sort framework configurations

* docs: add CakePHP docs

---------

Co-authored-by: tyler36 <[email protected]>
  • Loading branch information
tyler36 and tyler36 authored Jul 18, 2024
1 parent 53d9bed commit 578bfc2
Showing 1 changed file with 45 additions and 20 deletions.
65 changes: 45 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -36,52 +37,47 @@ Profiling in a production environment is not recommended.

## Framework configuration

### Drupal
### CakePHP

- 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.
- 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
Expand Down Expand Up @@ -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`.
Expand Down

0 comments on commit 578bfc2

Please sign in to comment.