Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit d449424

Browse filesBrowse files
Add missing steps for enabling Xdebug in Laravel Sail docs
1 parent 9fdd948 commit d449424
Copy full SHA for d449424

File tree

Expand file treeCollapse file tree

1 file changed

+38
-17
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+38
-17
lines changed

‎sail.md

Copy file name to clipboardExpand all lines: sail.md
+38-17Lines changed: 38 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@
2525
- [PHP Versions](#sail-php-versions)
2626
- [Node Versions](#sail-node-versions)
2727
- [Sharing Your Site](#sharing-your-site)
28+
- [Customization](#sail-customization)
2829
- [Debugging With Xdebug](#debugging-with-xdebug)
2930
- [Xdebug CLI Usage](#xdebug-cli-usage)
3031
- [Xdebug Browser Usage](#xdebug-browser-usage)
31-
- [Customization](#sail-customization)
3232

3333
<a name="introduction"></a>
3434
## Introduction
@@ -493,15 +493,51 @@ sail share --subdomain=my-sail-site
493493
> [!NOTE]
494494
> The `share` command is powered by [Expose](https://github.com/beyondcode/expose), an open source tunneling service by [BeyondCode](https://beyondco.de).
495495

496+
<a name="sail-customization"></a>
497+
## Customization
498+
499+
Since Sail is just Docker, you are free to customize nearly everything about it. To publish Sail's own Dockerfiles, you may execute the `sail:publish` command:
500+
501+
```shell
502+
sail artisan sail:publish
503+
```
504+
505+
After running this command, the Dockerfiles and other configuration files used by Laravel Sail will be placed within a `docker` directory in your application's root directory. After customizing your Sail installation, you may wish to change the image name for the application container in your application's `docker-compose.yml` file. After doing so, rebuild your application's containers using the `build` command. Assigning a unique name to the application image is particularly important if you are using Sail to develop multiple Laravel applications on a single machine:
506+
507+
```shell
508+
sail build --no-cache
509+
```
510+
496511
<a name="debugging-with-xdebug"></a>
497512
## Debugging With Xdebug
498513

499-
Laravel Sail's Docker configuration includes support for [Xdebug](https://xdebug.org/), a popular and powerful debugger for PHP. In order to enable Xdebug, you will need to add a few variables to your application's `.env` file to [configure Xdebug](https://xdebug.org/docs/step_debug#mode). To enable Xdebug you must set the appropriate mode(s) before starting Sail:
514+
Laravel Sail's Docker configuration includes support for [Xdebug](https://xdebug.org/), a popular and powerful debugger for PHP. To enable Xdebug, ensure you have published your Sail configuration as described in the [Customization section](#sail-customization). Then, add the following variables to your application's `.env` file to configure Xdebug:
500515

501516
```ini
502517
SAIL_XDEBUG_MODE=develop,debug,coverage
503518
```
504519

520+
Ensure that your `php.ini` file includes this line to activate the specified modes:
521+
522+
```ini
523+
[xdebug]
524+
xdebug.mode=${XDEBUG_MODE}
525+
```
526+
527+
After modifying the `php.ini` file, remember to rebuild your Docker container for the changes to take effect:
528+
529+
```shell
530+
sail build --no-cache
531+
```
532+
533+
To verify that Xdebug is correctly set, run:
534+
535+
```shell
536+
sail php -i | grep xdebug.mode
537+
```
538+
539+
This command should return the value set in `SAIL_XDEBUG_MODE`, confirming the correct configuration.
540+
505541
#### Linux Host IP Configuration
506542

507543
Internally, the `XDEBUG_CONFIG` environment variable is defined as `client_host=host.docker.internal` so that Xdebug will be properly configured for Mac and Windows (WSL2). If your local machine is running Linux and you're using Docker 20.10+, `host.docker.internal` is available, and no manual configuration is required.
@@ -550,18 +586,3 @@ If you're using PhpStorm, please review JetBrains' documentation regarding [zero
550586

551587
> [!WARNING]
552588
> Laravel Sail relies on `artisan serve` to serve your application. The `artisan serve` command only accepts the `XDEBUG_CONFIG` and `XDEBUG_MODE` variables as of Laravel version 8.53.0. Older versions of Laravel (8.52.0 and below) do not support these variables and will not accept debug connections.
553-
554-
<a name="sail-customization"></a>
555-
## Customization
556-
557-
Since Sail is just Docker, you are free to customize nearly everything about it. To publish Sail's own Dockerfiles, you may execute the `sail:publish` command:
558-
559-
```shell
560-
sail artisan sail:publish
561-
```
562-
563-
After running this command, the Dockerfiles and other configuration files used by Laravel Sail will be placed within a `docker` directory in your application's root directory. After customizing your Sail installation, you may wish to change the image name for the application container in your application's `docker-compose.yml` file. After doing so, rebuild your application's containers using the `build` command. Assigning a unique name to the application image is particularly important if you are using Sail to develop multiple Laravel applications on a single machine:
564-
565-
```shell
566-
sail build --no-cache
567-
```

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.