Skip to content

Commit 9a229f1

Browse files
updated README
1 parent 47b1965 commit 9a229f1

File tree

1 file changed

+36
-17
lines changed

1 file changed

+36
-17
lines changed

example/symfony64/README.md

Lines changed: 36 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,47 @@
22

33
This example shows how to integrate BugSnag with Symfony 6. Full instructions on how to set BugSnag up with Symfony can be found in [the official BugSnag documentation](https://docs.bugsnag.com/platforms/php/symfony/).
44

5+
## Using Docker
56

6-
## Installing dependencies
7+
This example comes with a `Dockerfile` you can use to run the project.
8+
Please first build the image:
9+
10+
```shell
11+
docker build -t bugsnag-symfony6 .
12+
```
13+
14+
Then run the container:
15+
16+
```shell
17+
docker run -it --rm -p 8000:8000 bugsnag-symfony6
18+
```
19+
20+
You can then access the application at [http://localhost:8000](http://localhost:8000).
21+
22+
## Manual installation
723

824
1. Install composer, following the instructions provided in the [composer documentation](http://getcomposer.org/doc/01-basic-usage.md)
925

10-
2. Install BugSnag using composer
26+
2. Install dependencies using composer
1127

1228
```shell
1329
composer install
1430
```
1531

32+
### Running the example
33+
34+
To run the example:
35+
36+
```shell
37+
symfony server:start
38+
```
39+
40+
Or for the command example:
41+
42+
```shell
43+
php bin/console app:crash
44+
```
45+
1646
## Configuring BugSnag
1747

1848
There are two ways of configuring your BugSnag client.
@@ -27,13 +57,14 @@ bugsnag:
2757

2858
2. Use environment variables. In this example you can set the `BUGSNAG_API_KEY` environment variable to your api key. This can also be set in the applications `.env` file:
2959

30-
```
60+
```env
3161
BUGSNAG_API_KEY=YOUR_API_KEY_HERE
3262
```
3363

3464
More information about configuring BugSnag can be found in [the configuration section of the BugSnag documentation](https://docs.bugsnag.com/platforms/php/symfony/configuration-options/).
3565

3666
In Symfony 6 the BugSnag bundle should be automatically registered in the `config/bundles.php` file:
67+
3768
```php
3869
return [
3970
// ...
@@ -48,13 +79,15 @@ BugSnag will now be set up and ready to notify of any exceptions.
4879
In order to use BugSnag in any of your classes you will need to require it via dependency injection.
4980

5081
In your services.yaml file, bind the Bugsnag\Client class to the @bugsnag service:
82+
5183
```yaml
5284
services:
5385
# resolve "Bugsnag\Client" to the BugSnag service
5486
Bugsnag\Client: '@bugsnag'
5587
```
5688

5789
Any of your classes requiring BugSnag can use the type Bugsnag\Client to access it:
90+
5891
```php
5992
private $bugsnag;
6093
@@ -65,17 +98,3 @@ public function __construct(\Bugsnag\Client $bugsnag)
6598
```
6699

67100
Which allows BugSnag to be used within the class as you would any other property.
68-
69-
## Running the example
70-
71-
To run the example:
72-
73-
```shell
74-
symfony server:start
75-
```
76-
77-
Or for the command example:
78-
79-
```shell
80-
php bin/console app:crash
81-
```

0 commit comments

Comments
 (0)