Lattice: Build Inertia UIs in PHP for Laravel | Mohamed Said        [  ![Mohamed Said](https://cdn.msaied.com/01KT78WE565VEMM3PSNQAAB0MH.png)   Mohamed Said Laravel Backend Engineer  ](https://msaied.com) [ Home ](https://msaied.com) [ Projects ](https://msaied.com/projects) [ Articles  ](https://msaied.com/articles) [ Certificates ](https://msaied.com/certificates) [ Contact ](https://msaied.com#contact-section) 

       [  ](https://github.com/EG-Mohamed)       

 [ Home ](https://msaied.com) [ Projects ](https://msaied.com/projects) [ Articles ](https://msaied.com/articles) [ Certificates ](https://msaied.com/certificates) [ Contact ](https://msaied.com#contact-section) 

  [ home ](https://msaied.com)    [ articles ](https://msaied.com/articles)    Lattice: Build Inertia UIs in Pure PHP Without Writing JSX        On this page       1. [  What Is Lattice? ](#what-is-lattice)
2. [  Pages as PHP Classes ](#pages-as-php-classes)
3. [  Forms Backed by Laravel Validation ](#forms-backed-by-laravel-validation)
4. [  Eloquent-Backed Tables ](#eloquent-backed-tables)
5. [  Actions and Client Effects ](#actions-and-client-effects)
6. [  Key Takeaways ](#key-takeaways)

  ![Lattice: Build Inertia UIs in Pure PHP Without Writing JSX](https://cdn.msaied.com/235/eab3e0fd6339f033e51100129b6ef132.png)

 [  Laravel ](https://msaied.com/articles?category=laravel) [  Composer Pacakge ](https://msaied.com/articles?category=composer-pacakge)  #Laravel   #Inertia.js   #Server-Driven UI   #PHP   #React   #Laravel Packages  

 Lattice: Build Inertia UIs in Pure PHP Without Writing JSX 
============================================================

     18 Jun 2026      3 min read    ![Mohamed Said](https://cdn.msaied.com/01KT78WE565VEMM3PSNQAAB0MJ.jpg)  Mohamed Said  

       Table of contents

1. [  01   What Is Lattice?  ](#what-is-lattice)
2. [  02   Pages as PHP Classes  ](#pages-as-php-classes)
3. [  03   Forms Backed by Laravel Validation  ](#forms-backed-by-laravel-validation)
4. [  04   Eloquent-Backed Tables  ](#eloquent-backed-tables)
5. [  05   Actions and Client Effects  ](#actions-and-client-effects)
6. [  06   Key Takeaways  ](#key-takeaways)

 What Is Lattice?
----------------

Lattice is a server-driven UI framework for Laravel that lets you describe your entire frontend — pages, forms, tables, and actions — using fluent PHP classes. It serializes that component tree into a typed payload, ships it over Inertia.js as a normal page visit, and a single React component resolves each node against a registry to render it.

The server becomes the single source of truth for what a screen *is*. The client's only job is rendering it.

Pages as PHP Classes
--------------------

Every page extends a base `Page` class and carries an `#[AsPage]` attribute that registers its route automatically — no manual route entries needed. The UI is assembled in a `render()` method using fluent components like `Stack`, `Grid`, `Heading`, and `Card`:

```php
#[AsPage(route: '/dashboard', middleware: ['web'])]
final class DashboardPage extends BasePage
{
    public function render(PageSchema $schema): PageSchema
    {
        return $schema->schema([
            Stack::make('dashboard')
                ->gap(Gap::Large)
                ->schema([
                    Heading::make('Dashboard'),
                    Grid::make('stats')
                        ->columns(2)
                        ->schema([
                            Card::make('Orders', '128 this week.'),
                            Card::make('Revenue', '$4,210 this week.'),
                        ]),
                ]),
        ]);
    }
}

```

Route-model binding works directly in the `render()` signature, and an `authorize()` method gates access before the page renders.

Forms Backed by Laravel Validation
----------------------------------

Forms extend `FormDefinition`. Fields are declared in PHP with standard Laravel validation rules, and the `handle()` method runs on a successful submission. Dropping a form onto a page is a single fluent call:

```php
Form::use(ProfileForm::class)
    ->method(HttpMethod::Patch)
    ->submitLabel('Save changes')
    ->precognitive(500)
    ->fill(['name' => $user->name, 'email' => $user->email]);

```

Adding `->precognitive(500)` opts into live validation through Laravel Precognition with a 500 ms debounce.

Eloquent-Backed Tables
----------------------

Tables extend `EloquentTableDefinition`. You declare columns and return a query builder; sorting, filtering, and pagination are handled automatically based on which columns you mark as `sortable()` or `filterable()`:

```php
#[AsTable('app.products')]
class ProductsTable extends EloquentTableDefinition
{
    public function columns(): array
    {
        return [
            TextColumn::make('name')->sortable()->filterable(),
            NumberColumn::make('price')->sortable()->filterable(),
            BooleanColumn::make('featured'),
        ];
    }

    public function builder(TableQuery $query): Builder
    {
        return Product::query();
    }
}

```

Rendering it on a page uses the same `::use()` pattern as forms: `Table::use(ProductsTable::class)`.

Actions and Client Effects
--------------------------

Actions extend `ActionDefinition` and return an `ActionResult` carrying *effects* — instructions the client dispatches, such as a toast notification or a component reload:

```php
public function handle(Request $request): ActionResult
{
    $product = $this->product($request);
    $product->update(['status' => 'archived']);

    return ActionResult::success()
        ->toast(Variant::Success, 'Product archived.')
        ->reloadComponent('app.products');
}

```

Attached to a table row, the action carries the row's context to the server so `handle()` knows which record it's acting on.

Key Takeaways
-------------

- **Zero manual routes** — `#[AsPage]` registers routes automatically by scanning configured paths.
- **PHP-only UI authoring** — no JSX, no TypeScript component files for standard screens.
- **Laravel-native validation** — rules, Precognition live validation, and route-model binding all work as expected.
- **Eloquent tables out of the box** — sorting, filtering, and pagination are declared, not hand-coded.
- **Server-side effects** — actions return typed instructions (toast, redirect, reload) rather than views.

Lattice is open source. Full documentation, component reference, and theming options are available at [latticephp.com](https://latticephp.com/), and the source is on [GitHub](https://github.com/lattice-php/lattice).

---

*Source: [Lattice: Describe Inertia UIs in PHP — Laravel News](https://laravel-news.com/lattice-describe-inertia-uis-in-php)*

 Found this useful?

          [  ](https://twitter.com/intent/tweet?url=https%3A%2F%2Fmsaied.com%2Farticles%2Flattice-build-inertia-uis-in-pure-php-without-writing-jsx&text=Lattice%3A+Build+Inertia+UIs+in+Pure+PHP+Without+Writing+JSX) [  ](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fmsaied.com%2Farticles%2Flattice-build-inertia-uis-in-pure-php-without-writing-jsx) 

 Frequently Asked Questions 
----------------------------

  3 questions  

     Q01  Does Lattice require writing any React or JSX code?        No. Lattice lets you describe your entire UI — pages, forms, tables, and actions — using fluent PHP classes. The framework serializes the component tree and a single React component on the client resolves and renders each node automatically. 

      Q02  How does Lattice handle form validation?        Form fields are declared in PHP with standard Laravel validation rules. Lattice validates the request server-side and runs the `handle()` method on success. You can also opt into live validation by chaining `-&gt;precognitive(500)`, which uses Laravel Precognition with a debounce delay. 

      Q03  Do I need to register routes manually when using Lattice pages?        No. Adding the `#[AsPage]` attribute to a page class is enough. Lattice scans your configured paths and registers the route automatically, including support for route parameters and route-model binding. 

  Continue reading

 More Articles 
---------------

 [ View all    ](https://msaied.com/articles) 

 [ ![PostgreSQL CTEs, Recursive Queries, and Lateral Joins in Laravel](https://cdn.msaied.com/241/32858f9c67eae0649999c32a6d31818f.png) laravel postgresql query-builder 

### PostgreSQL CTEs, Recursive Queries, and Lateral Joins in Laravel

Go beyond basic Eloquent with raw PostgreSQL power: composable CTEs, recursive tree traversal, and LATERAL joi...

  ![Mohamed Said](https://cdn.msaied.com/01KT78WE565VEMM3PSNQAAB0MJ.jpg)  Mohamed Said 

 19 Jun 2026     3 min read  

  Read    

 ](https://msaied.com/articles/postgresql-ctes-recursive-queries-and-lateral-joins-in-laravel) [ ![PostgreSQL Window Functions in Laravel: Ranking, Running Totals, and Gap Detection](https://cdn.msaied.com/239/f588e7cbf8e6d3317a581ce0fa27140d.png) laravel postgresql eloquent 

### PostgreSQL Window Functions in Laravel: Ranking, Running Totals, and Gap Detection

Window functions let you compute rankings, running totals, and gaps directly in SQL without pulling rows into...

  ![Mohamed Said](https://cdn.msaied.com/01KT78WE565VEMM3PSNQAAB0MJ.jpg)  Mohamed Said 

 19 Jun 2026     3 min read  

  Read    

 ](https://msaied.com/articles/postgresql-window-functions-in-laravel-ranking-running-totals-and-gap-detection) [ ![Custom Eloquent Casts: Encapsulating Domain Logic Inside Model Attributes](https://cdn.msaied.com/238/8e843e57a34f81f853eedefae629c09b.png) laravel eloquent domain-driven-design 

### Custom Eloquent Casts: Encapsulating Domain Logic Inside Model Attributes

Custom Eloquent casts let you push value-object logic directly into model attributes, keeping controllers and...

  ![Mohamed Said](https://cdn.msaied.com/01KT78WE565VEMM3PSNQAAB0MJ.jpg)  Mohamed Said 

 19 Jun 2026     3 min read  

  Read    

 ](https://msaied.com/articles/custom-eloquent-casts-encapsulating-domain-logic-inside-model-attributes) 

   [  ![Mohamed Said](https://cdn.msaied.com/01KT78WE565VEMM3PSNQAAB0MH.png)   Mohamed Said Laravel Backend Engineer  ](https://msaied.com)Senior Backend Engineer specializing in Laravel, scalable SaaS platforms, APIs, and cloud infrastructure. I build secure, high-performance web applications that help businesses grow.

Explore

- [Home](https://msaied.com)
- [Projects](https://msaied.com/projects)
- [Articles](https://msaied.com/articles)
- [Certificates](https://msaied.com/certificates)
- [Contact](https://msaied.com#contact-section)

Connect

- [   hello@msaied.com ](mailto:hello@msaied.com)
- [   +20 109 461 9204 ](tel:+201094619204)

© 2026 Mohamed Said. All rights reserved.

 [  ](https://github.com/EG-Mohamed) [  ](https://www.linkedin.com/in/msaiedm/) [  ](https://wa.me/201094619204) [  ](mailto:hello@msaied.com) [  ](https://drive.google.com/file/u/0/d/1MF20IPRJyzfy32mhEutjL5EpSls0w2Q8/view)
