Does Laravel Work With WordPress?
Laravel and WordPress can work together, but they're designed for different architectures—you're either using Laravel as a headless backend for WordPress, or replacing WordPress entirely with Laravel.
Quick Facts
How Laravel Works With WordPress
Laravel and WordPress don't integrate directly because they're competing solutions built on different philosophies. WordPress is a monolithic CMS optimized for content management with plugins, while Laravel is a framework for building custom applications. However, there are two practical approaches: First, use Laravel as a headless API backend with WordPress as a decoupled frontend—WordPress serves content through REST API calls to a Laravel frontend, useful when you need WordPress's content management but Laravel's flexibility for custom business logic. Second, use Roots Bedrock (Laravel-style WordPress development), which treats WordPress more like a Laravel application with better structure, though it's not true Laravel integration. A third approach is replacing WordPress entirely with Laravel using packages like Laravel Nova for admin dashboards or Filament for content management. Most developers choose this path when they need WordPress-level features but Laravel's development experience. The real friction point is that WordPress's plugin ecosystem doesn't play well with Laravel's PSR standards and modern PHP practices.
Best Use Cases
Laravel consuming WordPress REST API
composer require guzzlehttp/guzzle<?php
namespace App\Services;
use Illuminate\Support\Facades\Http;
class WordPressService
{
protected $baseUrl = 'https://wordpress-site.com/wp-json/wp/v2';
public function getPosts($perPage = 10)
{
return Http::get("{$this->baseUrl}/posts", [
'per_page' => $perPage,
'orderby' => 'date',
'order' => 'desc'
])->json();
}
public function getPost($id)
{
return Http::get("{$this->baseUrl}/posts/{$id}")->json();
}
}
// Usage in Controller
Route::get('/blog', function (WordPressService $wpService) {
return response()->json($wpService->getPosts());
});Known Issues & Gotchas
Database schema conflicts when Laravel and WordPress share the same database
Fix: Use separate databases or namespaced prefixes, or implement a API-first architecture where they don't share data directly
WordPress plugin conflicts with Laravel's autoloading and namespace system
Fix: Use Composer with WordPress (via Roots Bedrock) and avoid plugins that directly modify core files
Authentication systems don't align—WordPress uses its own auth while Laravel uses guards/middleware
Fix: Implement JWT or OAuth2 as a bridge layer, or use a dedicated auth service like Auth0
WordPress REST API pagination and filtering differs from Laravel's query conventions
Fix: Normalize API responses with transformer/presenter layers in Laravel before consuming WordPress endpoints
Alternatives
- •Statamic (Laravel-native CMS with better developer experience)
- •Craft CMS (flexible headless CMS with PHP backend, integrates naturally with Laravel)
- •Next.js/Nuxt + WordPress as headless backend (decoupled approach without Laravel overhead)
Resources
Related Compatibility Guides
Explore more compatibility guides