Skip to content
Back to Deployment

Deploying Laravel Apps

PHP artisan framework with Octane, Forge, or Vapor, plus queue workers and Horizon dashboard.

PlatformsAdvanced

Why

Laravel provides elegant syntax, Eloquent ORM, and a rich ecosystem (queues, events, broadcasting). Laravel Forge/Vapor offer one-click deploys, and Octane boosts performance 5-10x with Swoole/RoadRunner.

Platform-as-a-Service adoption grew 24% in 2024 as teams shift from VM management to git-push deploys. the cloud infrastructure market reached $330B in 2024, growing 22% year-over-year (Synergy Research), and PaaS layers capture the majority of new workloads.

When

Use Laravel for PHP web apps, SaaS, and APIs with rich domain logic. Choose Octane for high-traffic; Vapor for serverless AWS.

How

1. Build — composer install --no-dev, php artisan optimize 2. Forge — server provisioning + zero-downtime deploy via Git 3. Vapor — serverless on AWS Lambda, vapor deploy 4. Octane — php artisan octane:start --server=swoole for high-perf 5. Migrations — php artisan migrate:fresh --seed on first deploy only 6. Queue — php artisan queue:work, supervisor to keep alive 7. Storage — php artisan storage:link for public disk symlink 8. Env — .env.production, APP_DEBUG=false, APP_ENV=production

Example

# Dockerfile — Laravel + Nginx + PHP-FPM FROM composer:2 AS vendor WORKDIR /app COPY composer.* ./ RUN composer install --no-dev --optimize-autoloader FROM php:8.3-fpm-alpine WORKDIR /app COPY --from=vendor /app/vendor ./vendor COPY . . RUN php artisan optimize && php artisan storage:link EXPOSE 9000 # supervisor.conf — queue worker [program:queue] command=php /app/artisan queue:work redis --sleep=3 --tries=3 autostart=true autorestart=true # vapor.yml — serverless AWS name: myapp environments: production: database: myapp-prod cache: myapp-redis memory: 1024 runtime: php-8.3-alpine

Common Problems

  • ⚠Class not found after deploy — forgot composer dump-autoload or optimize
  • ⚠Storage link broken — php artisan storage:link not run, file uploads 404
  • ⚠Queue jobs stuck — no supervisor, queue:work dies and doesn't restart

Best Practices

  • ✓Use Laravel Octane (Swoole/RoadRunner) for high-traffic — keeps app booted in memory, 5-10x faster
  • ✓Run queue workers under supervisor — auto-restarts on crash, ensures jobs always process
  • ✓Set up health checks and graceful shutdown — handle SIGTERM to drain in-flight requests before exit

FAQ