Does Laravel Work With Netlify?

Partially CompatibleLast verified: 2026-02-26

Laravel can run on Netlify, but only through serverless functions or as a backend API—you cannot run traditional Laravel server-rendered apps directly on Netlify's static hosting.

Quick Facts

Compatibility
partial
Setup Difficulty
Moderate
Official Integration
No — community maintained
Confidence
high
Minimum Versions
Laravel: 8.0

How Laravel Works With Netlify

Laravel and Netlify have a constrained relationship because Netlify's core offering is static site hosting and serverless functions, while Laravel is built around persistent server processes. You have two viable paths: (1) Deploy Laravel as a traditional backend to a service like Heroku, Railway, or DigitalOcean App Platform, then use Netlify to host a decoupled frontend (Vue, React, or Livewire). (2) Use Netlify Functions (AWS Lambda under the hood) to run Laravel-like logic, though this requires significant refactoring since Laravel's ORM, middleware, and routing don't map cleanly to serverless execution models. The first approach is production-ready and recommended. The second is experimental and only viable for simple API endpoints. If you want server-rendered Laravel with Livewire or Blade, Netlify is not suitable—consider Vercel with serverless PHP support, or traditional hosting.

Best Use Cases

Decoupled JAMstack architecture: Laravel backend API on Railway/Heroku + Netlify-hosted Next.js/Nuxt frontend with serverless functions for lightweight middleware
Static site generation: Using Laravel to generate static HTML files (Statamic, Spatie's Static Site Generator) then deploying the output to Netlify
Webhook handlers: Simple Laravel API endpoints running on traditional hosting receiving webhooks and triggering Netlify builds or edge functions
Hybrid setup: Netlify Functions for lightweight request handlers that call a Laravel API backend for business logic

Laravel Backend API + Netlify Frontend Setup

bash
# On traditional hosting (Railway/Heroku)
composer create-project laravel/laravel backend
cd backend && git push heroku main

# On Netlify
npm create vite@latest frontend -- --template vue
cd frontend && netlify deploy
bash
// Netlify function calling Laravel backend
// netlify/functions/api-proxy.ts
import { Handler } from '@netlify/functions';

const LARAVEL_API = process.env.LARAVEL_BACKEND_URL || 'https://your-laravel-app.herokuapp.com';

export const handler: Handler = async (event) => {
  const path = event.path.replace('/.netlify/functions/api-proxy', '');
  const url = `${LARAVEL_API}${path}`;

  try {
    const response = await fetch(url, {
      method: event.httpMethod,
      headers: event.headers,
      body: event.body,
    });
    const data = await response.text();
    return {
      statusCode: response.status,
      body: data,
      headers: { 'Content-Type': response.headers.get('content-type') || 'application/json' },
    };
  } catch (error) {
    return { statusCode: 500, body: JSON.stringify({ error: error.message }) };
  }
};

Known Issues & Gotchas

critical

Laravel requires persistent processes; Netlify Functions timeout after 10 seconds (26s for Pro plans)

Fix: Keep backend logic on traditional hosting. Use Netlify Functions only for routing/validation, offload heavy operations to your Laravel backend

critical

Session management breaks across serverless invocations; stateless design required

Fix: Use JWT tokens or API keys instead of sessions. Implement Redis/database-backed session store if absolutely necessary

warning

Laravel ORM and routing don't work in serverless environment without major refactoring

Fix: If using Netlify Functions, treat them as thin wrappers; keep core logic in a traditional Laravel backend

warning

File uploads to Netlify Functions have size limits (6MB default, 50MB Pro)

Fix: Stream uploads directly to S3/cloud storage from the frontend, or proxy through a traditional Laravel backend

Alternatives

  • Vercel + Laravel: Vercel has native PHP support and serverless runtimes; better fit for traditional Laravel apps without major refactoring
  • Heroku + Netlify: Traditional approach—Heroku/Railway for Laravel backend, Netlify for static frontend; most production-ready
  • Docker on Railway/Render + Netlify: Deploy containerized Laravel backend, use Netlify for frontend and edge functions

Resources

Related Compatibility Guides

Explore more compatibility guides