Installation:
composer require symfony/web-server-bundle
Add to config/bundles.php (Symfony) or ensure it’s auto-loaded (Laravel via composer.json extras).
First Use Case: Run the built-in server for local development:
php artisan serve
http://localhost:8000 (default port).Where to Look:
php artisan list → serve command.config/app.php for trusted_proxies (if using reverse proxies).Local Development:
php -S localhost:8000 with php artisan serve for:
watch mode).php artisan serve --port=8080 --host=0.0.0.0
CI/CD/Testing:
php artisan serve --no-tls & sleep 2 && curl http://localhost:8000/api/health
symfony/process for async testing.Customization:
// config/app.php
'web_server' => [
'host' => env('APP_HOST', 'localhost'),
'port' => env('APP_PORT', 8000),
],
Symfony\Component\WebServer\Command (advanced).Integration with Laravel:
php artisan route:cache && php artisan serve
php artisan serve --port=8001 &
php artisan queue:work
Port Conflicts:
Address already in use.--port or lsof -i :8000 to kill existing processes.Trusted Proxies:
TRUSTED_PROXIES env var ignored if not set in Laravel’s trustedProxies config.// config/app.php
'trusted_proxies' => ['127.0.0.1', '::1'], // Add local IPs if using Docker
TLS/HTTPS:
mkcert or Nginx for HTTPS locally.mkcert -install && mkcert localhost && php artisan serve --tls
Performance:
APP_ENV=production.Logs:
storage/logs/laravel.log for server errors (e.g., missing routes).php artisan serve --verbose
Environment Variables:
APP_URL must match the server’s host/port.APP_URL=http://localhost:8000
Custom Commands:
serve command by publishing and modifying:
php artisan vendor:publish --tag=web-server-bundle
Symfony\Component\WebServer\Command\ServerCommand.Proxy Integration:
TRUSTED_PROXIES to simulate remote requests:
TRUSTED_PROXIES=192.168.1.100 php artisan serve
Docker:
# docker-compose.yml
services:
app:
ports:
- "8000:8000"
How can I help you explore Laravel packages today?