Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

alkhatib's avatar
Level 16

Livewire Full-page components VS Controller

Hello developers. I have a question, What is the best way, or rather the way adopted by most developers? Does it use Full-page components OR Controller -> view -> livewire component

0 likes
3 replies
LaryAI's avatar
Level 58

The choice between using Livewire full-page components and the traditional Controller -> View -> Livewire component approach depends on your specific use case and preferences. Here are some considerations and a solution for each approach:

Full-Page Livewire Components

Pros:

  • Simplifies the architecture by handling everything within a single Livewire component.
  • Easier to manage state and lifecycle hooks since everything is encapsulated in one place.
  • Ideal for pages that are highly interactive and require real-time updates.

Cons:

  • Can become complex and harder to manage if the component grows too large.
  • Might not be as intuitive for developers who are used to the traditional MVC pattern.

Example:

// In your routes/web.php
Route::get('/full-page', \App\Http\Livewire\FullPageComponent::class);

// In your Livewire component
namespace App\Http\Livewire;

use Livewire\Component;

class FullPageComponent extends Component
{
    public $message = 'Hello, Livewire!';

    public function render()
    {
        return view('livewire.full-page-component');
    }
}

// In your resources/views/livewire/full-page-component.blade.php
<div>
    <h1>{{ $message }}</h1>
</div>

Controller -> View -> Livewire Component

Pros:

  • Keeps the traditional MVC structure, which can be easier to understand and maintain.
  • Allows for better separation of concerns, making it easier to manage complex applications.
  • You can still use Livewire for specific parts of the page that require interactivity.

Cons:

  • Requires more boilerplate code to set up.
  • State management can be more complex as you need to pass data between the controller and the Livewire component.

Example:

Conclusion

Both approaches have their merits, and the best choice depends on your specific needs:

  • Use Full-Page Livewire Components if you prefer a more integrated approach and your page is highly interactive.
  • Use Controller -> View -> Livewire Component if you want to maintain a traditional MVC structure and only need Livewire for specific parts of the page.

Ultimately, you can even mix both approaches within the same application, using full-page components for some pages and the traditional MVC pattern for others.

vincent15000's avatar

I'm used to do like this :

  • if I have a full Livewire application, I'm using fullpage components

  • if I have a Laravel application where only some components are with Livewire (and not all the pages / components), I'm using Livewire components inside blade views loaded by a controller

2 likes
Snapey's avatar

Depends if I'm building a full page or a component?

If the blade file does not itself need any interactivity then I use a traditional blade file, and load it with dynamic components.

However, I've heard Caleb say he has stopped using controllers totally.

4 likes

Please or to participate in this conversation.