Skip to content
Merged
28 changes: 28 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"name": "debugphp-server",
"dockerComposeFile": "../docker-compose.yml",
"service": "app",
"workspaceFolder": "/var/www/html",
"forwardPorts": [
8787
],
"portsAttributes": {
"8787": {
"label": "DebugPHP Server"
}
},
"postCreateCommand": "composer install",
"customizations": {
"vscode": {
"extensions": [
"bmewburn.vscode-intelephense-client",
"xdebug.php-pack",
"EditorConfig.EditorConfig"
],
"settings": {
"php.validate.executablePath": "/usr/local/bin/php",
"intelephense.environment.phpVersion": "8.4"
}
}
}
}
16 changes: 16 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
.git
.gitignore

Dockerfile
docker-compose.yml
.dockerignore

.env
.env.*

data/

vendor/

.DS_Store
Thumbs.db
29 changes: 29 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
FROM serversideup/php:8.4-frankenphp-trixie

USER root

RUN apt-get update && apt-get install -y --no-install-recommends \
git \
unzip \
&& rm -rf /var/lib/apt/lists/*

WORKDIR /var/www/html

COPY --chown=www-data:www-data composer.json composer.lock* ./

RUN composer install \
--no-interaction \
--no-progress \
--prefer-dist \
--no-dev

COPY --chown=www-data:www-data . .

RUN mkdir -p /var/www/html/data \
&& chown -R www-data:www-data /var/www/html

ENV CADDY_SERVER_ROOT=/var/www/html

USER www-data

EXPOSE 8787
21 changes: 20 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,22 @@ This is the server and dashboard component of [DebugPHP](https://github.com/Call

## Installation

### Option A — PHP built-in server

```bash
git clone https://github.com/CallMeLeon167/debugphp-server.git
cd debugphp-server
composer install
php -S localhost:8787
```

Then open `http://localhost:8080/setup/` in your browser and follow the setup wizard.
### Option B — Docker

```bash
git clone https://github.com/CallMeLeon167/debugphp-server.git
cd debugphp-server
docker compose up
```

---

Expand All @@ -54,6 +63,16 @@ Debug::send('Hello DebugPHP!');
Debug::send($user, 'User')->color('blue');
```

## Running inside Docker?

Enable auto-detection so the client finds the server automatically:

```php
Debug::init('your-session-token', [
'dockerized' => true,
]);
```

See the [DebugPHP client repository](https://github.com/CallMeLeon167/debugphp) for the full API documentation.

---
Expand Down
49 changes: 49 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
services:
app:
build:
context: .
dockerfile: Dockerfile
container_name: debugphp-server
hostname: debugphp-server
user: root
ports:
- '8787:8787'
environment:
CADDY_HTTP_PORT: '8787'
volumes:
- ./:/var/www/html:cached
- vendor:/var/www/html/vendor
- data:/var/www/html/data
working_dir: /var/www/html
networks:
- debugphp
restart: unless-stopped

network-joiner:
image: docker:cli
container_name: debugphp-network-joiner
restart: unless-stopped
depends_on:
- app
volumes:
- /var/run/docker.sock:/var/run/docker.sock
command: >
sh -c '
echo "[joiner] starting auto-join loop...";
while true; do
for net in $$(docker network ls --format "{{.Name}}" | grep -Ev "^(bridge|host|none|debugphp)$$"); do
if ! docker network inspect "$$net" --format "{{range .Containers}}{{.Name}} {{end}}" | grep -q "debugphp-server"; then
docker network connect "$$net" debugphp-server 2>/dev/null && echo "[joiner] joined $$net" || true;
fi;
done;
sleep 10;
done
'

volumes:
vendor:
data:

networks:
debugphp:
name: debugphp
2 changes: 1 addition & 1 deletion src/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
final class Config
{
/** @var string */
private string $version = '0.3.2';
private string $version = '0.4.0';

/** @var self */
private static self $instance;
Expand Down