Laravel

Laravel

Short guide to publish a Laravel app on Devployer.

Before you start

  • GitHub repository with your Laravel project
  • package-lock.json committed (the build uses npm ci)
  • Compatible PHP (recommended: 8.2–8.4)

Step by step

1. Add nixpacks.toml at the project root

Create nixpacks.toml at the repository root (next to composer.json) with this content:

[phases.install]
cmds = [
    "composer install --no-dev --prefer-dist --optimize-autoloader --no-interaction",
    "npm ci"
]

[phases.build]
cmds = [
    "npm run build",
    "rm -f bootstrap/cache/config.php",
    "rm -f bootstrap/cache/routes-*.php",
    "rm -f bootstrap/cache/events.php",
    "chmod -R 775 storage bootstrap/cache"
]

[start]
cmd = "php artisan optimize:clear && php artisan serve --host=0.0.0.0 --port=80"

This file defines install, build, and start for Nixpacks. Start uses php artisan serve on port 80.

2. Commit and push

git add nixpacks.toml
git commit -m "Add nixpacks.toml for Devployer Laravel deploy"
git push

3. Create the application in Devployer

  1. Open Devployer and choose Deploy from GitHub
  2. Select the repository and branch
  3. Choose the Laravel framework
  4. Select the PHP version if prompted
  5. Create the application (you can enable instant deploy)

4. Configure environment variables

In the app, make sure you have at least:

VariableNotes
APP_KEYDevployer can generate it when creating the app
APP_ENVUse production at runtime; avoid forcing it only at build unless needed
APP_URLPublic URL of the app

If you attach a managed database from Devployer, DB_* variables are injected automatically.

5. Deploy and verify

  1. Wait for the build to finish
  2. Open the public URL
  3. If it fails, check the deployment logs in Devployer

Quick checklist

  • nixpacks.toml at the repo root
  • package-lock.json committed
  • Laravel framework selected in Devployer
  • APP_KEY configured
  • Redeploy after changing nixpacks.toml or dependencies