You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: README.md
+11-4
Original file line number
Diff line number
Diff line change
@@ -51,6 +51,7 @@ The constructor takes a single parameter, `$envPrefix`, which is upper-cased and
51
51
*[Process configuration](#process-configuration)
52
52
*[Troubleshooting](#troubleshooting)
53
53
*[Extending the library](#extending-the-library)
54
+
*[Examples](#examples)
54
55
55
56
### How it works
56
57
@@ -64,6 +65,8 @@ A temporary ini file is created from the loaded (and scanned) ini files, with an
64
65
* The application runs and exits.
65
66
* The main process exits with the exit code from the restarted process.
66
67
68
+
See [Examples](#examples) for further information.
69
+
67
70
#### Signal handling
68
71
Asynchronous signal handling is automatically enabled if the pcntl extension is loaded. `SIGINT` is set to `SIG_IGN` in the parent
69
72
process and restored to `SIG_DFL` in the restarted process (if no other handler has been set).
@@ -74,7 +77,7 @@ From PHP 7.4 on Windows, `CTRL+C` and `CTRL+BREAK` handling is automatically ena
74
77
There are a few things to be aware of when running inside a restarted process.
75
78
76
79
* Extensions set on the command-line will not be loaded.
77
-
* Ini file locations will be reported as per the restart - see [getAllIniFiles()](#getallinifiles).
80
+
* Ini file locations will be reported as per the restart - see [getAllIniFiles()](#getallinifiles-array).
78
81
* Php sub-processes may be loaded with Xdebug enabled - see [Process configuration](#process-configuration).
79
82
80
83
### Helper methods
@@ -200,12 +203,12 @@ Uses environment variables to remove Xdebug from the new process and persist the
200
203
201
204
>_If the new process calls a PHP sub-process, Xdebug will not be loaded in that sub-process._
202
205
203
-
This strategy can be used in the restart by calling [setPersistent()](#setpersistent).
206
+
This strategy can be used in the restart by calling [setPersistent()](#setpersistent-self).
204
207
205
208
#### Sub-processes
206
209
The `PhpConfig` helper class makes it easy to invoke a PHP sub-process (with or without Xdebug loaded), regardless of whether there has been a restart.
207
210
208
-
Each of its methods returns an array of PHP options (to add to the command-line) and sets up the environment for the required strategy. The [getRestartSettings()](#getrestartsettings) method is used internally.
211
+
Each of its methods returns an array of PHP options (to add to the command-line) and sets up the environment for the required strategy. The [getRestartSettings()](#getrestartsettings-array) method is used internally.
209
212
210
213
*`useOriginal()` - Xdebug will be loaded in the new process.
211
214
*`useStandard()` - Xdebug will **not** be loaded in the new process - see [standard settings](#standard-settings).
@@ -245,7 +248,7 @@ The API is defined by classes and their accessible elements that are not annotat
245
248
By default the process will restart if Xdebug is loaded and not running with `xdebug.mode=off`. Extending this method allows an application to decide, by returning a boolean (or equivalent) value.
246
249
It is only called if `MYAPP_ALLOW_XDEBUG` is empty, so it will not be called in the restarted process (where this variable contains internal data), or if the restart has been overridden.
247
250
248
-
Note that the [setMainScript()](#setmainscriptscript) and [setPersistent()](#setpersistent) setters can be used here, if required.
251
+
Note that the [setMainScript()](#setmainscriptstring-script-self) and [setPersistent()](#setpersistent-self) setters can be used here, if required.
249
252
250
253
#### _restart(array $command): void_
251
254
An application can extend this to modify the temporary ini file, its location given in the `tmpIni` property. New settings can be safely appended to the end of the data, which is `PHP_EOL` terminated.
@@ -294,5 +297,9 @@ class MyRestarter extends XdebugHandler
294
297
}
295
298
```
296
299
300
+
### Examples
301
+
The `tests\App` directory contains command-line scripts that demonstrate the internal workings in a variety of scenarios.
302
+
See [Functional Test Scripts](./tests/App/README.md).
303
+
297
304
## License
298
305
composer/xdebug-handler is licensed under the MIT License, see the LICENSE file for details.
0 commit comments