Last active
June 14, 2023 06:29
-
-
Save kiddtang/5dc75293806369d443f9f9a6be861d0d to your computer and use it in GitHub Desktop.
Youtube - Boosts your Laravel Sail
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
OCTANE_SERVER=swoole | |
OCTANE_HTTPS=true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SWOOLE_SOCK_TCP | ((bool) $config['swoole']['ssl'] ?? 0) * SWOOLE_SSL, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ports: | |
- '${APP_PORT:-80}:80' | |
- 8000:8000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
XDEBUG: '${APP_DEBUG:-false}' | |
XDEBUG_PORT: '${SAIL_XDEBUG_PORT:-9000}' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
RUN mkdir -p /etc/swoole/ssl/certs/ /etc/swoole/ssl/private/ | |
RUN openssl req -x509 -nodes -days 365 -subj "/C=CA/ST=QC/O=Artisan, Inc./CN=localhost" \ | |
-addext "subjectAltName=DNS:localhost" -newkey rsa:2048 \ | |
-keyout /etc/swoole/ssl/private/sail-selfsigned.key \ | |
-out /etc/swoole/ssl/certs/sail-selfsigned.crt; | |
RUN chmod 644 /etc/swoole/ssl/certs/*.crt | |
RUN chown -R root:sail /etc/swoole/ssl/private/ | |
RUN chmod 640 /etc/swoole/ssl/private/*.key |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ARG XDEBUG | |
ARG XDEBUG_PORT | |
RUN if [ "${XDEBUG}" = 'true' ] ; then \ | |
apt-get update \ | |
&& apt-get install -y php-xdebug \ | |
&& echo "[XDebug]" > /etc/php/8.0/cli/php.ini \ | |
&& echo "zend_extension="$(find /usr/lib/php/20200930/ -name xdebug.so)" > /etc/php/8.0/cli/php.ini" \ | |
&& echo "xdebug.mode = debug" >> /etc/php/8.0/cli/php.ini \ | |
&& echo "xdebug.discover_client_host = true" >> /etc/php/8.0/cli/php.ini \ | |
&& echo "xdebug.client_host = host.docker.internal" >> /etc/php/8.0/cli/php.ini \ | |
&& echo "xdebug.client_port = ${XDEBUG_PORT}" >> /etc/php/8.0/cli/php.ini \ | |
&& apt-get -y autoremove \ | |
&& apt-get clean \ | |
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* ;\ | |
fi; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"version": "0.2.0", | |
"configurations": [ | |
{ | |
"name": "Listen for Sail Xdebug", | |
"type": "php", | |
"request": "launch", | |
"port": 9000, | |
"pathMappings": { | |
"/var/www/html": "${workspaceFolder}" | |
}, | |
"hostname": "localhost", | |
"ignore": ["**/vendor/**/*.php"], | |
"xdebugSettings": { | |
"max_data": 65536, | |
"show_hidden": 1, | |
"max_children": 100, | |
"max_depth": 3 | |
} | |
}, | |
] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
|-------------------------------------------------------------------------- | |
| Octane Swoole Configuration Options | |
|-------------------------------------------------------------------------- | |
| | |
| While using Swoole, you may define additional configuration options as | |
| required by the application. You maycheck which options you need from: | |
| https://www.swoole.co.uk/docs/modules/swoole-server/configuration | |
| | |
*/ | |
'swoole' => [ | |
'ssl' => true, | |
'options' => [ | |
'ssl_cert_file' => '/etc/swoole/ssl/certs/sail-selfsigned.crt', | |
'ssl_key_file' => '/etc/swoole/ssl/private/sail-selfsigned.key', | |
] | |
], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
path=$(printf '%s\n' "${PWD##*/}") | |
command="docker exec ${path}_laravel.test_1 php "$@"" | |
echo "Running php on docker ${path}_laravel.test_1" | |
$command |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"php.validate.executablePath": "/usr/local/bin/php" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[supervisord] | |
nodaemon=true | |
user=root | |
logfile=/var/log/supervisor/supervisord.log | |
pidfile=/var/run/supervisord.pid | |
[program:php-octane] | |
command=/usr/bin/php -d variables_order=EGPCS /var/www/html/artisan octane:start --server=swoole --host=0.0.0.0 --port=8000 --watch | |
user=sail | |
environment=LARAVEL_SAIL="1" | |
stdout_logfile=/dev/stdout | |
stdout_logfile_maxbytes=0 | |
stderr_logfile=/dev/stderr | |
stderr_logfile_maxbytes=0 | |
[program:php-serve] | |
command=/usr/bin/php -d variables_order=EGPCS /var/www/html/artisan serve --host=0.0.0.0 --port=80 | |
user=sail | |
environment=LARAVEL_SAIL="1" | |
stdout_logfile=/dev/stdout | |
stdout_logfile_maxbytes=0 | |
stderr_logfile=/dev/stderr | |
stderr_logfile_maxbytes=0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mix.browserSync({ | |
proxy: 'https://localhost:8000', | |
open: false, | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You are right! Since Larave Sail v 1.9.0, the Xdebug was included as default.
You can refer to official docs https://laravel.com/docs/8.x/sail#debugging-with-xdebug
Alternatively my Updated Medium: https://blog.devgenius.io/xdebug-laravel-sail-project-in-vs-code-b7b73e3dedf7#fac6