Skip to content

Commit

Permalink
Adding VSCode launch.json file for xdebug and XDEBUG-SETUP.md.
Browse files Browse the repository at this point in the history
  • Loading branch information
sharmaamitt16 committed Jul 7, 2020
1 parent a9ba081 commit 5087203
Show file tree
Hide file tree
Showing 16 changed files with 201 additions and 80 deletions.
Binary file added .screenshots/xdebug_1.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .screenshots/xdebug_2.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .screenshots/xdebug_3.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
64 changes: 64 additions & 0 deletions starterkits/XDEBUG-SETUP.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# XDebug Setup on VS Code with Docker PHP container

## Tasks to do inside VSCode.

- [Download VSCode Editor](https://code.visualstudio.com/download)
- [Configure VSCode for drupal development](https://www.drupal.org/docs/develop/development-tools/configuring-visual-studio-code)
- Install PHP debug extension if not installed as given in screen in previous step.
- Click the small bug icon on the lefthand sidebar.

![xdebug icon](../.screenshots/xdebug_1.png)

- Check if .vscode/launch.json file is available in your vega project.
- If .vscode/launch.json file is not available follow next step.
- Click the small cog on the upper left side to open your IDE's launch.json file.


![add launch json](../.screenshots/xdebug_2.png)


- Add below configuration in the launch.json.

```
{
"version": "0.2.0",
"configurations": [
{
"name": "Listen for XDebug for Vega Applications.",
"type": "php",
"request": "launch",
"port": 9001,
"log": true,
"pathMappings": {
"/app": "${workspaceFolder}"
}
}
]
}
```

@NOTE: In the previous configurations in launch.json file:

```
"pathMappings": {
"/app": "${workspaceFolder}"
}
```

The left side key is the path of your docroot in the docker container (forex /app)
The right side key is the path of code docroot in the VSCode (forex ~/Sites/your_project).

## Debugging the code

- Open any PHP file in VSCode.
- Add a breakpoint by clicking on the left side of the line. After adding in a breakpoint, you will see the red point on the line.
- Click on the bug icon on the left side of the VSCode toolbar. Select your configuration from the drop-down menu at the top.
- Open your script in the browser.
- Come back to the VSCode to see the live debugging.


![debug window](../.screenshots/xdebug_3.png)


- Use the palette visible in top right to step over, step in, step out, or continue and other options during debugging.
- Enjoy Debugging.
3 changes: 0 additions & 3 deletions starterkits/drupal8-php-fpm-apache/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,3 @@ web/sites/simpletest

# Ignore files generated by PhpStorm
/.idea/

# Ignore files generated by vscode
/.vscode
15 changes: 15 additions & 0 deletions starterkits/drupal8-php-fpm-apache/.vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "Listen for XDebug for Vega Application.",
"type": "php",
"request": "launch",
"port": 9001,
"log": true,
"pathMappings": {
"/app": "${workspaceFolder}"
}
}
]
}
36 changes: 19 additions & 17 deletions starterkits/drupal8-php-fpm-apache/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,20 +28,22 @@ recommended alias:
alias ddrush="docker-compose run --rm php drush"
```
---
### Configure Blackfire:
1. Login to https://blackfire.io/
2. Go to https://blackfire.io/my/settings/credentials
3. Find Server ID and Server Token under My Server Credentials Section.
4. Configure the blackfire server id and token in .env file under your vega project as given below.

| Parameter | File | Variable |
|:----------------------:|:-------:|:----------------------:|
| Blackfire Server Id | .env | BLACKFIRE_SERVER_ID |
| Blackfire Server Token | .env | BLACKFIRE_SERVER_TOKEN |

5. Open docker-compose.yml under your vega project.
6. Uncomment blackfire service under blackfire section.
7. Run vega up.
8. Go to your browser and install Blackfire agent extension.
9. Open your site: http://localhost:8080/
10. Click on the extension on your browser and profile your application.
### Profiling:
- Get your blackfire server id and token from https://blackfire.io/my/settings/credentials
- Configure the blackfire server id and token in .env file.

| Parameter | File | Variable |
|:----------------------:|:-------:|:----------------------:|
| Blackfire Server Id | .env | BLACKFIRE_SERVER_ID |
| Blackfire Server Token | .env | BLACKFIRE_SERVER_TOKEN |

- Uncomment blackfire service in docker-compose.yml.
- Run vega up.
- Install blackfire agent extension in your browser.
- Click on the extension on your browser and profile your application.

---
### Debugging:

Follow the document to setup xdebug:
[Setup Xdebug](/starterkits/XDEBUG-SETUP.md)
3 changes: 0 additions & 3 deletions starterkits/drupal8-php-fpm-nginx/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,3 @@ web/sites/simpletest

# Ignore files generated by PhpStorm
/.idea/

# Ignore files generated by vscode
/.vscode
15 changes: 15 additions & 0 deletions starterkits/drupal8-php-fpm-nginx/.vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "Listen for XDebug for Vega Application.",
"type": "php",
"request": "launch",
"port": 9001,
"log": true,
"pathMappings": {
"/app": "${workspaceFolder}"
}
}
]
}
36 changes: 19 additions & 17 deletions starterkits/drupal8-php-fpm-nginx/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,20 +28,22 @@ recommended alias:
alias ddrush="docker-compose run --rm php drush"
```
---
### Configure Blackfire:
1. Login to https://blackfire.io/
2. Go to https://blackfire.io/my/settings/credentials
3. Find Server ID and Server Token under My Server Credentials Section.
4. Configure the blackfire server id and token in .env file under your vega project as given below.

| Parameter | File | Variable |
|:----------------------:|:-------:|:----------------------:|
| Blackfire Server Id | .env | BLACKFIRE_SERVER_ID |
| Blackfire Server Token | .env | BLACKFIRE_SERVER_TOKEN |

5. Open docker-compose.yml under your vega project.
6. Uncomment blackfire service under blackfire section.
7. Run vega up.
8. Go to your browser and install Blackfire agent extension.
9. Open your site: http://localhost:8080/
10. Click on the extension on your browser and profile your application.
### Profiling:
- Get your blackfire server id and token from https://blackfire.io/my/settings/credentials
- Configure the blackfire server id and token in .env file.

| Parameter | File | Variable |
|:----------------------:|:-------:|:----------------------:|
| Blackfire Server Id | .env | BLACKFIRE_SERVER_ID |
| Blackfire Server Token | .env | BLACKFIRE_SERVER_TOKEN |

- Uncomment blackfire service in docker-compose.yml.
- Run vega up.
- Install blackfire agent extension in your browser.
- Click on the extension on your browser and profile your application.

---
### Debugging:

Please follow the document to setup xdebug:
[Setup Xdebug](/starterkits/XDEBUG-SETUP.md)
3 changes: 0 additions & 3 deletions starterkits/drupal9-php-fpm-apache/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,3 @@ web/sites/simpletest

# Ignore files generated by PhpStorm
/.idea/

# Ignore files generated by vscode
/.vscode
15 changes: 15 additions & 0 deletions starterkits/drupal9-php-fpm-apache/.vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "Listen for XDebug for Vega Application.",
"type": "php",
"request": "launch",
"port": 9001,
"log": true,
"pathMappings": {
"/app": "${workspaceFolder}"
}
}
]
}
37 changes: 20 additions & 17 deletions starterkits/drupal9-php-fpm-apache/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,20 +28,23 @@ recommended alias:
alias ddrush="docker-compose run --rm php drush"
```
---
### Configure Blackfire:
1. Login to https://blackfire.io/
2. Go to https://blackfire.io/my/settings/credentials
3. Find Server ID and Server Token under My Server Credentials Section.
4. Configure the blackfire server id and token in .env file under your vega project as given below.

| Parameter | File | Variable |
|:----------------------:|:-------:|:----------------------:|
| Blackfire Server Id | .env | BLACKFIRE_SERVER_ID |
| Blackfire Server Token | .env | BLACKFIRE_SERVER_TOKEN |

5. Open docker-compose.yml under your vega project.
6. Uncomment blackfire service under blackfire section.
7. Run vega up.
8. Go to your browser and install Blackfire agent extension.
9. Open your site: http://localhost:8080/
10. Click on the extension on your browser and profile your application.
### Profiling:
- Get your blackfire server id and token from https://blackfire.io/my/settings/credentials
- Configure the blackfire server id and token in .env file.

| Parameter | File | Variable |
|:----------------------:|:-------:|:----------------------:|
| Blackfire Server Id | .env | BLACKFIRE_SERVER_ID |
| Blackfire Server Token | .env | BLACKFIRE_SERVER_TOKEN |

- Uncomment blackfire service in docker-compose.yml.
- Run vega up.
- Install blackfire agent extension in your browser.
- Click on the extension on your browser and profile your application.
Click on the extension on your browser and profile your application.

---
### Debugging:

Please follow the document to setup xdebug:
[Setup Xdebug](/starterkits/XDEBUG-SETUP.md)
3 changes: 0 additions & 3 deletions starterkits/drupal9-php-fpm-nginx/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,3 @@ web/sites/simpletest

# Ignore files generated by PhpStorm
/.idea/

# Ignore files generated by vscode
/.vscode
15 changes: 15 additions & 0 deletions starterkits/drupal9-php-fpm-nginx/.vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "Listen for XDebug for Vega Application.",
"type": "php",
"request": "launch",
"port": 9001,
"log": true,
"pathMappings": {
"/app": "${workspaceFolder}"
}
}
]
}
36 changes: 19 additions & 17 deletions starterkits/drupal9-php-fpm-nginx/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,20 +28,22 @@ recommended alias:
alias ddrush="docker-compose run --rm php drush"
```
---
### Configure Blackfire:
1. Login to https://blackfire.io/
2. Go to https://blackfire.io/my/settings/credentials
3. Find Server ID and Server Token under My Server Credentials Section.
4. Configure the blackfire server id and token in .env file under your vega project as given below.

| Parameter | File | Variable |
|:----------------------:|:-------:|:----------------------:|
| Blackfire Server Id | .env | BLACKFIRE_SERVER_ID |
| Blackfire Server Token | .env | BLACKFIRE_SERVER_TOKEN |

5. Open docker-compose.yml under your vega project.
6. Uncomment blackfire service under blackfire section.
7. Run vega up.
8. Go to your browser and install Blackfire agent extension.
9. Open your site: http://localhost:8080/
10. Click on the extension on your browser and profile your application.
### Profiling:
- Get your blackfire server id and token from https://blackfire.io/my/settings/credentials
- Configure the blackfire server id and token in .env file.

| Parameter | File | Variable |
|:----------------------:|:-------:|:----------------------:|
| Blackfire Server Id | .env | BLACKFIRE_SERVER_ID |
| Blackfire Server Token | .env | BLACKFIRE_SERVER_TOKEN |

- Uncomment blackfire service in docker-compose.yml.
- Run vega up.
- Install blackfire agent extension in your browser.
- Click on the extension on your browser and profile your application.

---
### Debugging:

Please follow the document to setup xdebug:
[Setup Xdebug](/starterkits/XDEBUG-SETUP.md)

0 comments on commit 5087203

Please sign in to comment.