Deploying Laravel Applications
2 min read
Updated 1 month ago
Laravel on Ploi Cloud
Ploi Cloud is optimized for Laravel applications, providing automatic configuration and best practices out of the box.
Automatic Configuration
When you create a Laravel application, Ploi Cloud automatically:
- Sets up the correct PHP version and extensions
- Installs your Composer dependencies
- Runs database migrations during deployment
- Generates a secure APP_KEY for encryption
- Configures Laravel scheduler (when enabled)
Environment Secrets
Essential environment variables for Laravel applications:
APP_ENV=production
APP_DEBUG=false
Database connection variables are automatically injected when you add a database service.
Database Migrations
Migrations run automatically as init container commands during deployment:
- The default command is
php artisan migrate --force
- Migrations run before your application starts
- If migrations fail, the deployment stops to prevent issues
Queue Workers
To process Laravel queues, add a Worker service:
- Navigate to your application's Services section
- Click "Add service" and select "Worker"
- Enter a descriptive name (e.g., "queue-worker")
- Set the command to
php artisan queue:work --sleep=3 --tries=3
- Deploy your application to start the worker
Workers use the same code and storage as your main application.
Laravel Scheduler
The Laravel scheduler runs your scheduled tasks automatically:
- Go to your application's Settings tab
- Find the "Laravel scheduler" section
- Toggle "Enable scheduler" to activate it
- Deploy your application to apply the change
The scheduler executes php artisan schedule:run
every minute.
Build Commands
Default build commands for Laravel applications:
composer install --no-interaction --optimize-autoloader --no-dev
- If you enable frontend builds:
npm ci
andnpm run build
You can customize these in the Build Configuration section.