@@ -10,20 +10,24 @@ these two steps:
1010 ``` sh
1111 composer require google/cloud-error-reporting
1212 ```
13- 1 . Create a [ ` php.ini ` ] ( php.ini ) file in the root of your project and set
14- ` auto_prepend_file ` to the following:
15- ``` ini
16- ; in php.ini
17- auto_prepend_file =/srv/vendor/google/cloud-error-reporting/src/prepend.php
13+ 1 . Add the command to autoload the "prepend.php" file at the beginning of every
14+ request in `composer.json:
15+ ``` js
16+ {
17+ " autoload" : {
18+ " files" : [" vendor/google/cloud-error-reporting/src/prepend.php" ]
19+ }
20+ }
21+
1822 ```
1923
2024The [` prepend.php` ][prepend] file will be executed prior to each request, which
2125registers the client library' s error handler.
2226
2327[prepend]: https://github.com/GoogleCloudPlatform/google-cloud-php-errorreporting/blob/main/src/prepend.php
2428
25- If you cannot modify your `php.ini` , the `prepend.php` file can be manually
26- included to register the error handler:
29+ Alternatively , the `prepend.php` file can be manually included to register the
30+ error handler:
2731
2832```php
2933# This works for files in the root of your project. Adjust __DIR__ accordingly.
@@ -56,8 +60,10 @@ in your browser. Browse to `/` to see a list of examples to execute.
5660
5761### Run Locally
5862
59- Uncomment the `require_once` statement at the top of [`index.php`](index.php),
60- or add the `auto_prepend_file` above to your local `php.ini`.
63+ The `prepend.php` file will be autoloaded on each request via composer. You
64+ can also uncomment the `require_once` statement at the top of
65+ [`index.php`](index.php), or load the file using `auto_prepend_file` in your
66+ local `php.ini`.
6167
6268Now run the sample locally using PHP' s build- in web server:
6369
0 commit comments