Ehsan Bagherzadegan
Back to articles
9 min read

Pollora: Running WordPress Inside Laravel with PHP Attributes and Blade

Pollora lets you run WordPress inside a Laravel application — Laravel handles routing and controllers, WordPress provides the CMS. Define post types, hooks, and meta with PHP 8 attributes; render Gutenberg blocks with Blade.

Pollora is a Laravel framework that runs WordPress inside a Laravel application. Instead of choosing between Laravel's developer experience and WordPress's content management ecosystem, Pollora lets you have both: Laravel boots first and handles front-end routing, controllers, and Blade templates, while WordPress core, its admin dashboard, database schema, and plugin ecosystem continue working normally.

The project reached v13.39.0 on October 27, 2026, matching Laravel's version number. It requires PHP 8.3+ (PHP 8.4+ for the skeleton), Laravel 13.39, and WordPress 7.1+. This is not a proof-of-concept — it's a production-ready framework with a diagnostic command (pollora:doctor), multi-theme support, and integrations for WooCommerce, Gravity Forms, and Yoast SEO.

Why This Matters Now

The WordPress-Laravel integration space has existed for years. Acorn brings Laravel components into WordPress. Sage is a WordPress starter theme using Blade. Corcel reads WordPress data from a separate Laravel app. Radicle is a paid starter kit on the Roots stack.

Pollora takes a different architectural approach: Laravel is the outer application, WordPress runs inside it. WordPress core is installed via Composer into public/cms. The Laravel router handles incoming requests first, and you decide which routes go to WordPress via Route::wp() or Route::wpMatch(). This means your Laravel middleware, authentication, rate limiting, and route groups apply uniformly — even to WordPress-rendered pages.

For teams maintaining a Laravel application that needs a blog, documentation site, or marketing pages powered by WordPress, this eliminates the complexity of running two separate applications, synchronizing users, or proxying requests.

Installation and Project Structure

You can start a new Pollora project two ways:

# Via the Pollora CLI (includes DDEV support for local development)
composer global require pollora/cli
pollora new my-project --ddev

# Or directly with Composer
composer create-project pollora/pollora my-project

The skeleton installs Laravel, WordPress core (in public/cms), and configures the necessary service providers. Key directories:

app/
  Models/           # Your Laravel models
  Http/Controllers/ # Your Laravel controllers
  Pollora/          # WordPress post types, taxonomies, hooks as PHP classes
config/
  pollora.php       # Pollora configuration
public/
  cms/              # WordPress core (managed by Composer)
  themes/           # Your Blade-based themes
resources/
  views/            # Blade templates for Laravel routes
  themes/           # Theme-specific Blade templates

Defining Post Types and Taxonomies with Attributes

Pollora replaces functions.php registration with PHP 8 attributes. This is the most immediately visible difference for WordPress developers.

// app/Pollora/PostTypes/Book.php
namespace App\Pollora\PostTypes;

use Pollora\Attributes\PostType;
use Pollora\Attributes\PostType\HasArchive;
use Pollora\Attributes\PostType\Supports;
use Pollora\Attributes\PostType\ShowInRest;

#[PostType(
    singular: 'Book',
    plural: 'Books',
    slug: 'books'
)]
#[HasArchive(slug: 'books')]
#[Supports(['title', 'editor', 'thumbnail', 'excerpt', 'custom-fields'])]
#[ShowInRest]
class Book {}

Taxonomies follow the same pattern:

// app/Pollora/Taxonomies/Genre.php
namespace App\Pollora\Taxonomies;

use Pollora\Attributes\Taxonomy;
use Pollora\Attributes\Taxonomy\Hierarchical;
use Pollora\Attributes\Taxonomy\ShowInRest;

#[Taxonomy(
    singular: 'Genre',
    plural: 'Genres',
    slug: 'genre',
    objectTypes: ['book']
)]
#[Hierarchical]
#[ShowInRest]
class Genre {}

Run php artisan pollora:discover (or let auto-discovery handle it) and these are registered with WordPress. No register_post_type() calls, no init hook boilerplate.

Hooks and Filters as Methods

WordPress hooks become methods on plain PHP classes with attributes:

// app/Pollora/Hooks/Seo.php
namespace App\Pollora\Hooks;

use Pollora\Attributes\Filter;

class Seo
{
    #[Filter('document_title_parts')]
    public function customizeTitle(array $parts): array
    {
        $parts[] = '| My Site';
        return $parts;
    }

    #[Filter('wp_title', priority: 10, acceptedArgs: 2)]
    public function filterTitle(string $title, string $sep): string
    {
        return $title . $sep . ' My Site';
    }
}

Actions work the same way with #[Action]. AJAX handlers use #[Ajax], WP-CLI commands use #[WpCli], and REST routes use #[WpRestRoute]. All are auto-discovered.

Typed Meta and User Roles

Custom fields and user roles get type safety through attributes:

// app/Pollora/Meta/BookMeta.php
namespace App\Pollora\Meta;

use Pollora\Attributes\PostMeta;

class BookMeta
{
    #[PostMeta(key: 'isbn', type: 'string', single: true)]
    public string $isbn;

    #[PostMeta(key: 'price', type: 'number', single: true)]
    public float $price;

    #[PostMeta(key: 'authors', type: 'array')]
    public array $authors = [];
}

Roles are declared similarly:

// app/Pollora/Roles/Editor.php
namespace App\Pollora\Roles;

use Pollora\Attributes\Role;
use Pollora\Attributes\Role\Capability;

#[Role('editor', 'Content Editor')]
class Editor
{
    #[Capability('edit_posts')]
    #[Capability('publish_posts')]
    #[Capability('edit_others_posts')]
    public function capabilities(): array
    {
        return ['edit_posts', 'publish_posts', 'edit_others_posts'];
    }
}

Routing: Laravel First, WordPress Second

The router is where Pollora's architecture shines. In routes/web.php:

use Illuminate\Support\Facades\Route;

// Your Laravel routes
Route::get('/dashboard', [DashboardController::class, 'index'])
    ->middleware(['auth', 'verified']);

// WordPress handles everything matching its conditional tags
Route::wp();

// Or be specific: only WordPress for these conditions
Route::wpMatch([
    'is_home' => true,
    'is_singular' => ['post', 'page', 'book'],
]);

Route::wp() delegates to WordPress for any request matching WordPress's template hierarchy. Route::wpMatch() accepts an array of conditional tags — useful when you want WordPress to handle the blog and custom post types, but keep certain paths (like /api/* or /admin/*) in Laravel.

You can also prefix WordPress:

Route::prefix('blog')->group(function () {
    Route::wp();
});

Rendering Gutenberg Blocks with Blade

Pollora renders Gutenberg blocks using Blade templates instead of React. Define a block template:

{{-- resources/themes/default/blocks/core/heading.blade.php --}}

Block Bindings API support lets you connect block attributes to dynamic data (meta fields, ACF fields, custom sources) without writing JavaScript.

Theming: Blade Templates with Sage Directives

Themes live in public/themes/ or resources/themes/. They use Blade with Sage directives (@wp_head, @wp_footer, @body_class, etc.):

{{-- resources/themes/default/templates/single-book.blade.php --}}
@extends('layouts.app')

@section('content')
    @while(have_posts())
        @the_post()
        
    @endwhile
@endsection

The theme system supports parent/child themes, dynamic PSR-4 autoloading for theme helpers, and Vite asset bundling out of the box.

Media Library on Any Laravel Disk

WordPress uploads use Laravel's filesystem abstraction. Configure a disk in config/filesystems.php (S3, R2, Cloudflare R2, local, etc.) and set it as the media disk in config/pollora.php:

'media' => [
    'disk' => env('POLORA_MEDIA_DISK', 's3'),
    'url' => env('POLORA_MEDIA_URL'),
],

Uploaded files go to your configured storage. No plugin required.

Authentication Integration

Pollora provides a WordPress authentication guard that uses WordPress's password hashing (phpass / wp_hash_password). Users can log in via the WordPress admin or your Laravel login form — the same credentials work for both.

// config/auth.php
'guards' => [
    'web' => [
        'driver' => 'session',
        'provider' => 'users',
    ],
    'wordpress' => [
        'driver' => 'pollora',
        'provider' => 'wp_users',
    ],
],

Event Dispatching for Popular Plugins

Pollora dispatches Laravel events for WooCommerce, Gravity Forms, and Yoast SEO actions:

// Listen for WooCommerce order completion
use Pollora\Events\WooCommerce\OrderCompleted;

Event::listen(OrderCompleted::class, function (OrderCompleted $event) {
    $order = $event->order; // WC_Order object
    // Trigger Laravel notification, queue job, etc.
});

This lets you react to WordPress plugin events in Laravel code — queue jobs, send notifications, sync to external APIs — without writing WordPress plugin code.

Module System

Pollora includes nwidart/laravel-modules for organizing large applications. Each module can have its own post types, taxonomies, hooks, themes, and routes:

modules/
  Blog/
    app/Pollora/PostTypes/Post.php
    app/Pollora/Taxonomies/Category.php
    resources/themes/blog/
    routes/wp.php
  Shop/
    app/Pollora/PostTypes/Product.php
    resources/themes/shop/

Diagnostics with pollora:doctor

Run php artisan pollora:doctor to verify your setup. It checks:

  • WordPress core installation in public/cms
  • Database connection and table prefix
  • Required PHP extensions
  • File permissions on public/cms/wp-content
  • Theme and plugin directories
  • WP-CLI availability
  • Cron configuration

It also integrates with WordPress's Tools → Site Health screen.

When to Use Pollora (and When Not To)

Use Pollora when:

  • You have a Laravel application that needs a CMS for content-heavy sections (blog, docs, marketing pages, knowledge base)
  • You want to use WordPress plugins (WooCommerce, Gravity Forms, Yoast, ACF) without maintaining a separate WordPress site
  • Your team prefers Laravel's routing, middleware, testing, and deployment tooling
  • You need typed, maintainable code for post types, hooks, and meta — not functions.php spaghetti

Consider alternatives when:

  • You only need to read WordPress data from Laravel → use Corcel
  • You have an existing WordPress site and want to sprinkle in Laravel components → use Acorn
  • You're building a traditional WordPress theme → use Sage
  • You need a mature ecosystem with thousands of installations → Acorn and Sage have significantly more production history

Pollora is younger (v13.x started in 2024) and has fewer installs than Acorn or Sage. For mission-critical projects, evaluate the bus factor and community support.

Practical Example: Adding a Blog to a Laravel SaaS

Imagine a Laravel SaaS application where marketing wants a blog managed in WordPress, but engineering wants to keep the main app in Laravel.

  1. Install Pollora into the existing Laravel project (or start fresh with the skeleton)
  2. Define a Post post type (already included by default) and any custom taxonomies
  3. Create a Blade theme in resources/themes/default/ matching your app's design system
  4. Add Route::prefix('blog')->wp() to routes/web.php
  5. Configure the media disk to use your S3 bucket
  6. Marketing team logs into /cms/wp-admin and writes posts; engineers deploy the same repo

No separate WordPress hosting, no user sync, no cross-origin cookie issues. The blog runs on the same domain, same session, same deployment pipeline.

Conclusion

Pollora fills a specific gap: teams that want Laravel's architecture for their application logic and WordPress's content management for their editorial workflows, without running two applications. The attribute-based registration, Blade-based theming, and Laravel-first routing make it feel like a native Laravel package rather than a WordPress integration hack.

If you've ever maintained a functions.php file that grew into a small application, or synchronized users between Laravel and WordPress, or proxied requests between two deployments — Pollora is worth evaluating.

Sources