Lattice: Build Inertia UIs in PHP for Laravel | Mohamed Said       [Skip to content](#main)  [ ![](https://cdn.msaied.com/01KT78WE565VEMM3PSNQAAB0MH.png) Mohamed SaidLaravel Backend Engineer ](https://www.msaied.com/public) - [Home](https://www.msaied.com/public)
- [Projects](https://www.msaied.com/public/projects)
- [Articles](https://www.msaied.com/public/articles)
- [Certificates](https://www.msaied.com/public/certificates)
- [About](https://www.msaied.com/public#about)

           [  Contact](https://www.msaied.com/public#contact) Menu 

Menu
----

Close 

 - [HomeStart here](https://www.msaied.com/public)
- [ProjectsCase studies](https://www.msaied.com/public/projects)
- [ArticlesEngineering notes](https://www.msaied.com/public/articles)
- [CertificatesCredentials](https://www.msaied.com/public/certificates)
- [AboutHow I work](https://www.msaied.com/public#about)
- [ContactGet in touch](https://www.msaied.com/public#contact)

  [Start a conversation](https://www.msaied.com/public#contact) [WhatsApp](https://wa.me/201094619204) [Email](mailto:hello@msaied.com) 

 1. [Home](https://www.msaied.com/public)
2. /
3. [Articles](https://www.msaied.com/public/articles)
4. /
5. [Laravel](https://www.msaied.com/public/articles?category=laravel)
6. /
7. Lattice: Build Inertia UIs in Pure PHP Without Writing JSX

   [Laravel](https://www.msaied.com/public/articles?category=laravel) [Composer Pacakge](https://www.msaied.com/public/articles?category=composer-pacakge) 

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

 Lattice is a server-driven UI framework for Laravel that lets you describe pages, forms, tables, and actions entirely in PHP, then renders them as real React components over Inertia.js.

 ![](https://cdn.msaied.com/01M22N44A70A5MC2S599JP0MPH.webp) [Mohamed Said](https://www.msaied.com/public#person) Published 18 Jun 2026 · Updated 18 Jun 2026 · 3 min read

ShareCopy linkCopied

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

  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)

 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)*

- [Laravel](https://www.msaied.com/public/articles?search=Laravel)
- [Inertia.js](https://www.msaied.com/public/articles?search=Inertia.js)
- [Server-Driven UI](https://www.msaied.com/public/articles?search=Server-Driven%20UI)
- [PHP](https://www.msaied.com/public/articles?search=PHP)
- [React](https://www.msaied.com/public/articles?search=React)
- [Laravel Packages](https://www.msaied.com/public/articles?search=Laravel%20Packages)

 Frequently asked questions 
---------------------------

  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.

   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.

   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.

   ![Mohamed Said](https://cdn.msaied.com/01M22N44A70A5MC2S599JP0MPH.webp)About the author
----------------

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

[About](https://www.msaied.com/public#about) [GitHub ↗](https://github.com/EG-Mohamed) [LinkedIn ↗](https://www.linkedin.com/in/msaiedm/) [WhatsApp ↗](https://wa.me/201094619204) [Email Address ↗](mailto:hello@msaied.com) [My CV ↗](https://drive.google.com/file/u/0/d/1MF20IPRJyzfy32mhEutjL5EpSls0w2Q8/view)  

   [Previous articlePostgreSQL JSONB in Laravel: Indexing, Querying, and Casting Without the Chaos](https://www.msaied.com/public/articles/postgresql-jsonb-in-laravel-indexing-querying-and-casting-without-the-chaos-1) [Next articleLaravel Service Container: Contextual Binding, Tagging, and Method Injection](https://www.msaied.com/public/articles/laravel-service-container-contextual-binding-tagging-and-method-injection)  

   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)

 ###  Have a technical challenge?

 Tell me what you’re building. I reply within two working days.

[Start a conversation](https://www.msaied.com/public#contact) 

   Related articles
-----------------

 [ ![](https://cdn.msaied.com/740/cce86edc21eddcbdd2f2454fadaf9c70.png)  · 3 min read### The Pipeline Pattern in Laravel: Custom Pipelines Beyond Middleware

5 Oct 2026 ](https://www.msaied.com/public/articles/the-pipeline-pattern-in-laravel-custom-pipelines-beyond-middleware-1) [ ![](https://cdn.msaied.com/739/2d6897fdcdcf090613f96f72a64b8a78.png)  · 4 min read### MySQL Full-Text Search in Laravel: Indexes, Relevance Scoring, and Boolean Mode

4 Oct 2026 ](https://www.msaied.com/public/articles/mysql-full-text-search-in-laravel-indexes-relevance-scoring-and-boolean-mode) [ ![](https://cdn.msaied.com/738/073696a3fefe18bec825beec5ac658f5.png)  · 4 min read### Laravel Queue Rate-Limited Middleware: Throttling Jobs Without Losing Work

4 Oct 2026 ](https://www.msaied.com/public/articles/laravel-queue-rate-limited-middleware-throttling-jobs-without-losing-work) 

  Have a technical challenge?
----------------------------

Tell me what you’re building. I reply within two working days.

 [Discuss your project ↗](https://www.msaied.com/public#contact) 

  © 2026 Mohamed Said · Built with Laravel, meant to last.Senior Backend Engineer specializing in Laravel, scalable SaaS platforms, APIs, and cloud infrastructure. I build secure, high-performance web applications that help businesses grow.

 - [Home](https://www.msaied.com/public)
- [Articles](https://www.msaied.com/public/articles)
- [Certificates](https://www.msaied.com/public/certificates)
- [GitHub](https://github.com/EG-Mohamed)
- [LinkedIn](https://www.linkedin.com/in/msaiedm/)
- [WhatsApp](https://wa.me/201094619204)
- [Email Address](mailto:hello@msaied.com)
- [My CV](https://drive.google.com/file/u/0/d/1MF20IPRJyzfy32mhEutjL5EpSls0w2Q8/view)
- [Sitemap](https://www.msaied.com/public/sitemap.xml)
