ijpatricio/mingle
MingleJS lets you use React or Vue components inside Laravel Livewire apps. It renders a server-side div and mounts the JS component client-side, passing data from PHP and enabling easy server actions via $wire for “islands” of interactivity.
Core Stack Alignment:
@mingle directive, preserving Livewire’s server-driven reactivity and Blade templating.Tooling Synergy:
Architectural Patterns:
Pilot Phase (Low Risk):
@mingle directive.@mingle('TodoList', ['todos' => $todos])
resources/js/components/TodoList.vue).Incremental Rollout:
Full Adoption:
@vue/compiler-sfc is compatible with Laravel Mix/Vite.vite.config.js to resolve MingleJS components:
import { defineConfig } from 'vite';
import laravel from 'laravel-vite-plugin';
import vue from '@vitejs/plugin-vue';
export default defineConfig({
plugins: [
laravel({
input: ['resources/js/app.js', 'resources/js/components/**/*.vue'],
refresh: true,
}),
vue(),
],
});
// In a Filament resource
public static function form(Form $form): Form {
return $form
->schema([
// ...
MingleJS::make('CustomComponent', [
'data' => $this->getCustomData(),
]),
]);
}
Prerequisites:
@vitejs/plugin-vue, @vitejs/plugin-react).composer require ijpatricio/mingle
npm install @vue/compiler-sfc vue react react-dom # or equivalent for React
Development Workflow:
@mingle directive.resources/js/components/.@mingle props.$wire object in JS for server actions (e.g., $wire.addTodo(todo)).sequenceDiagram
participant Livewire
participant Blade
participant MingleJS
participant Vue
participant Server
Livewire->>Blade: Render @mingle('TodoList', ['todos' => $todos])
Blade->>MingleJS: Inject div with data-attributes
MingleJS->>Vue: Mount TodoList.vue
Vue->>Server: Emit $wire.addTodo(todo)
Server->>Livewire: Handle server action
Livewire->>Vue: Update props via Livewire events
Testing and Validation:
@testing-library/vue).Deployment:
Dependency Management:
dependabot or laravel-dependency-updater to track updates.composer.json and package.json to avoid unexpected updates.composer.json:
"require": {
"ijpatricio/mingle": "^1.0",
"laravel/livewire": "^3.0"
}
Component Lifecycle:
How can I help you explore Laravel packages today?