# Laravel Hosting: Deploy PHP Applications the Modern Way

· 4 min read
# Laravel Hosting: Deploy PHP Applications the Modern Way

**Primary keywords:** laravel hosting, deploy laravel app, laravel cloud hosting, managed laravel hosting, laravel deployment guide
---
Laravel has redefined what PHP development looks like. Eloquent ORM, expressive routing, built-in queues, and a rich ecosystem of first-party packages make it one of the most productive web frameworks regardless of language. But Laravel applications have specific deployment needs — PHP version compatibility, the Artisan CLI, queue workers, and task scheduling. This guide walks through deploying Laravel applications to managed cloud hosting.
## Laravel's Production Requirements
Deploying Laravel correctly means handling:
- PHP version matching your `composer.json` requirements
- `composer install --no-dev --optimize-autoloader` for production
- `php artisan key:generate` for the `APP_KEY`
- `php artisan migrate --force` for database updates
- `php artisan config:cache` and `php artisan route:cache` for performance
deploy express app production
- `php artisan storage:link` if using file uploads
- Queue workers for jobs dispatched to queues
## Project Configuration
### .env.example → Environment Variables
Laravel uses `.env` files in development, but in production, use environment variables directly. Never commit `.env` with secrets.
Your `config/*.php` files should reference `env()`:
```php
// config/database.php
'pgsql' => [
'driver' => 'pgsql',
'url' => env('DATABASE_URL'),
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', '5432'),
'database' => env('DB_DATABASE', 'forge'),
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''),
'sslmode' => 'require',
],
```
### Procfile
```
web: php artisan serve --host=0.0.0.0 --port=$PORT
release: php artisan migrate --force && php artisan config:cache && php artisan route:cache && php artisan view:cache
```
For better production performance, use Octane or a traditional PHP-FPM setup. With Octane:
```
web: php artisan octane:start --server=roadrunner --host=0.0.0.0 --port=$PORT
release: php artisan migrate --force && php artisan config:cache && php artisan route:cache
```
## Deploying to ApexWeave
```bash
apexweave login
# Set all required Laravel environment variables
apexweave env:set APP_NAME="My Laravel App"
apexweave env:set APP_ENV=production
apexweave env:set APP_DEBUG=false
apexweave env:set APP_URL=https://yourdomain.com
# Generate and set the app key
apexweave env:set APP_KEY=$(php artisan key:generate --show)
# Database
apexweave env:set DB_CONNECTION=pgsql
apexweave env:set DB_HOST=your-db-host
apexweave env:set DB_PORT=5432
apexweave env:set DB_DATABASE=mylaravel
fast cloud wordpress hosting
apexweave env:set DB_USERNAME=dbuser
apexweave env:set DB_PASSWORD=secure-password
# Cache and sessions
Apex Weave
apexweave env:set CACHE_DRIVER=database
apexweave env:set SESSION_DRIVER=database
apexweave deploy
```
## Eloquent Models
```php
// app/Models/Post.php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Factories\HasFactory;
class Post extends Model
use HasFactory;
protected $fillable = ['title', 'body', 'published_at'];
protected $casts = [
'published_at' => 'datetime',
];
public function user(): BelongsTo
return $this->belongsTo(User::class);
public function scopePublished($query)
return $query->whereNotNull('published_at');
```
## API Controllers
```php
// app/Http/Controllers/Api/PostController.php
namespace App\Http\Controllers\Api;
use App\Http\Controllers\Controller;
use App\Models\Post;
use App\Http\Requests\StorePostRequest;
use App\Http\Resources\PostResource;
use Illuminate\Http\Request;
class PostController extends Controller
public function index()
$posts = Post::published()
->with('user')
->latest()
->paginate(20);
return PostResource::collection($posts);
public function store(StorePostRequest $request)
$post = $request->user()->posts()->create($request->validated());
return new PostResource($post);
public function show(Post $post)
return new PostResource($post->load('user'));
public function update(StorePostRequest $request, Post $post)
$this->authorize('update', $post);
$post->update($request->validated());
return new PostResource($post);
public function destroy(Post $post)
$this->authorize('delete', $post);
$post->delete();
return response()->noContent();
```
## Queue Workers
For background jobs, add a worker process to your Procfile:
```
web: php artisan serve --host=0.0.0.0 --port=$PORT
worker: php artisan queue:work --tries=3 --timeout=90 --sleep=3
release: php artisan migrate --force && php artisan config:cache
```
```bash
apexweave env:set QUEUE_CONNECTION=database
```
## Task Scheduling
Laravel's scheduler runs via cron. On ApexWeave, run it with a worker process:
```
scheduler: php artisan schedule:work
```
Or handle scheduling from within a worker that runs every minute.
## Redis for Caching and Queues
```bash
apexweave env:set REDIS_URL=redis://your-redis-host:6379
apexweave env:set CACHE_DRIVER=redis
continuous deployment nodejs
apexweave env:set QUEUE_CONNECTION=redis
apexweave env:set SESSION_DRIVER=redis
```
## Streaming Logs
```bash
apexweave logs --follow
```
Laravel logs to `storage/logs/laravel.log` by default. In production, route logs to stdout:
```php
// config/logging.php
'default' => env('LOG_CHANNEL', 'stack'),
'channels' => [
'stack' => [
'driver' => 'stack',
'channels' => ['stderr'],
],
'stderr' => [
'driver' => 'monolog',
'handler' => Monolog\Handler\StreamHandler::class,
'with' => ['stream' => 'php://stderr'],
],
],
```
```bash
apexweave env:set LOG_CHANNEL=stderr
```
## SSH Access
```bash
apexweave ssh
# Run Artisan commands on production
php artisan tinker
php artisan migrate:status
php artisan queue:monitor
```
## Custom Domain
```bash
apexweave domain:add yourdomain.com
apexweave domain:add www.yourdomain.com
# Update APP_URL
apexweave env:set APP_URL=https://yourdomain.com
# Rebuild caches
apexweave deploy
apexweave hosting


```
## Plan Recommendations
- **AppForge Starter ($5/mo):** Personal Laravel projects, portfolios, small APIs
- **AppForge Pro ($10/mo):** Production Laravel apps, SaaS products, e-commerce
- **AppForge XL ($15/mo):** High-traffic applications, apps with multiple queue workers, media-heavy Laravel apps
## Laravel in Production with Confidence
Laravel's feature richness is a genuine advantage — but it requires thoughtful deployment to work correctly. The caching commands (`config:cache`, `route:cache`, `view:cache`) are critical for performance. The release step in your Procfile ensures migrations run atomically before traffic shifts. ApexWeave's zero-downtime deploy model ensures your users never see a 500 during a deploy.
Start your **free 7-day trial on ApexWeave** today. Run `apexweave deploy` and have your Laravel application running on production HTTPS infrastructure in minutes.