Laravel
Laravel
Short guide to publish a Laravel app on Devployer.
Before you start
- GitHub repository with your Laravel project
package-lock.jsoncommitted (the build usesnpm 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
- Open Devployer and choose Deploy from GitHub
- Select the repository and branch
- Choose the Laravel framework
- Select the PHP version if prompted
- Create the application (you can enable instant deploy)
4. Configure environment variables
In the app, make sure you have at least:
| Variable | Notes |
|---|---|
APP_KEY | Devployer can generate it when creating the app |
APP_ENV | Use production at runtime; avoid forcing it only at build unless needed |
APP_URL | Public URL of the app |
If you attach a managed database from Devployer, DB_* variables are injected automatically.
5. Deploy and verify
- Wait for the build to finish
- Open the public URL
- If it fails, check the deployment logs in Devployer
Quick checklist
-
nixpacks.tomlat the repo root -
package-lock.jsoncommitted - Laravel framework selected in Devployer
-
APP_KEYconfigured - Redeploy after changing
nixpacks.tomlor dependencies