Unscripted
For Laravel · PHP 8.4 in WebAssembly

PHP components that run in the browser.

Write components in PHP and Blade, the way you would with Livewire. Unscripted runs them in the browser, so clicks, typing and re-renders need no request. Only the methods you mark #[Server] reach your Laravel app.

$ composer require unscripted/ui-server:dev-main

resources/components/todos.blade.php
<?php
use App\Models\Todo;
use Unscripted\Ui\{Component, Server, State};

new class extends Component {
    #[State] public string $draft = '';

    // Runs on your Laravel app, called like a function.
    #[Server]
    public static function create(string $title): void
    {
        Todo::create(['title' => $title]);
    }

    // Runs in the browser. `yield` waits for the server.
    public function add(): Generator
    {
        yield static::create($this->draft);
        $this->draft = '';
    }
};
?>

<form u-on:submit.prevent="add">
    <input u-model="draft" placeholder="What needs doing?">
    <button>Add</button>
</form>

How it works

One component file, two places it runs.

The server renders it first

The page arrives as HTML, loaders and all, so it's there before any PHP loads in the browser.

The browser takes over

PHP 8.4, compiled to WebAssembly, runs the same class. Actions, bindings and re-renders happen right there.

The server, when you ask

A #[Server] method's body stays on Laravel; the browser gets a stub that calls it, with validation and permissions.

What's in the box

The parts of Livewire you'd reach for, working without the round trips.

Familiar

Blade templates, u-model, u-on:click, events, nested components and lifecycle hooks.

Forms

Laravel's validation rules, checked as you type in the browser and again on the server.

Loaders

Server methods that fill a property on mount and run again when what they watch changes.

Live updates

Change data on the server and every open page showing it updates, over Reverb or polling.

Streaming and uploads

Text that arrives as it's made, and uploads with progress, kept safe until you store them.

Navigation

Move between pages without loading PHP again, keeping what you choose across pages.

Examples

Games in Rust and WebGL, with Unscripted components for their menus, scores and results; and smaller demos of the framework itself.

All the examples →

Build your first component

A counter, then a todo list with a database, in ten minutes.