Skip to content

Commit f02b083

Browse files
committed
Add missing file
1 parent 1138e72 commit f02b083

File tree

2 files changed

+71
-6
lines changed

2 files changed

+71
-6
lines changed

core/events.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -109,9 +109,8 @@ Constant | Event | Priority |
109109
Some of those built-in listeners can be enabled/disabled by setting request attributes ([for instance in the `defaults`
110110
attribute of an operation](operations.md#recommended-method)):
111111

112-
Listener | Parameter | Values | Default | Description |
113-
----------------------|----------------|----------------|---------|----------------------------------------|
114-
`ReadListener` | `_api_receive` | `true`/`false` | `true` | set to `false` to disable the listener |
115-
`DeserializeListener` | `_api_receive` | `true`/`false` | `true` | set to `false` to disable the listener |
116-
`ValidateListener``_api_receive` | `true`/`false` | `true` | set to `false` to disable the listener |
117-
`SerializeListener``_api_respond` | `true`/`false` | `true` | set to `false` to disable the listener |
112+
Attribute | Type | Default | Description |
113+
---------------|--------|---------|--------------------------------------------------------------------------------------|
114+
`_api_receive` | `bool` | `true` | Enables or disables the `ReadListener`, `DeserializeListener` and `ValidateListener` |
115+
`_api_respond` | `bool` | `true` | Enables or disables `SerializeListener` |
116+
`_api_persist` | `bool` | `true` | Enables or disables `WriteLister` |

distribution/debugging.md

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# Debugging
2+
3+
The default Docker stack is shipped without a Xdebug stage. It's easy
4+
though to add [Xdebug](https://xdebug.org/) to your project, for development
5+
purposes such as debugging tests or API requests remotely.
6+
7+
## Add a Development Stage to the Dockerfile
8+
9+
To avoid deploying API Platform to production with an active Xdebug extension,
10+
it's recommended to add a custom stage to the end of the `api/Dockerfile`.
11+
12+
```Dockerfile
13+
# api/Dockerfile
14+
FROM api_platform_php as api_platform_php_dev
15+
16+
ARG XDEBUG_VERSION=2.6.0
17+
RUN set -eux; \
18+
apk add --no-cache --virtual .build-deps $PHPIZE_DEPS; \
19+
pecl install xdebug-$XDEBUG_VERSION; \
20+
docker-php-ext-enable xdebug; \
21+
apk del .build-deps
22+
```
23+
24+
## Configure Xdebug with Docker Compose Override
25+
26+
Using an [override](https://docs.docker.com/compose/reference/overview/#specifying-multiple-compose-files)
27+
file named `docker-compose.override.yml` ensures that the production
28+
configuration remains untouched.
29+
30+
As example, an override could look like this:
31+
32+
```yml
33+
version: "3.4"
34+
35+
services:
36+
php:
37+
build:
38+
target: api_platform_php_dev
39+
environment:
40+
# See https://docs.docker.com/docker-for-mac/networking/#i-want-to-connect-from-a-container-to-a-service-on-the-host
41+
# See https://github.com/docker/for-linux/issues/264
42+
# The `remote_host` below may optionally be replaced with `remote_connect_back`
43+
XDEBUG_CONFIG: >-
44+
remote_enable=1
45+
remote_host=host.docker.internal
46+
remote_port=9000
47+
idekey=PHPSTORM
48+
# This should correspond to the server declared in PHPStorm `Preferences | Languages & Frameworks | PHP | Servers`
49+
# Then PHPStorm will use the corresponding path mappings
50+
PHP_IDE_CONFIG: serverName=api-platform
51+
```
52+
53+
## Troubleshooting
54+
55+
Inspect the installation with the following command. The requested Xdebug
56+
version should be displayed in the output.
57+
58+
```bash
59+
$ docker-compose exec php php --version
60+
61+
PHP 7.2.8 (cli) (built: Jul 21 2018 08:09:37) ( NTS )
62+
Copyright (c) 1997-2018 The PHP Group
63+
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
64+
with Zend OPcache v7.2.8, Copyright (c) 1999-2018, by Zend Technologies
65+
with Xdebug v2.6.0, Copyright (c) 2002-2018, by Derick Rethans
66+
```

0 commit comments

Comments
 (0)