chedaroo/inertia-marko

The Marko adapter for Inertia.js.

Maintainers

Package info

github.com/chedaroo/inertia-marko

Type:marko-module

pkg:composer/chedaroo/inertia-marko

Statistics

Installs: 4

Dependents: 0

Suggesters: 0

Stars: 2

Open Issues: 0

v0.1.2 2026-04-21 15:36 UTC

This package is auto-updated.

Last update: 2026-04-21 15:37:09 UTC


README

The Marko PHP server-side adapter for Inertia.js.

Requirements

  • PHP 8.5+
  • Marko PHP framework with marko/view and marko/view-latte

Installation

composer require chedaroo/inertia-marko

Usage

use Inertia\InertiaInterface;
use Inertia\Middleware\HandleInertiaRequests;
use Marko\Routing\Attributes\Get;
use Marko\Routing\Attributes\Middleware;
use Marko\Routing\Http\Response;

class DashboardController
{
    public function __construct(
        private readonly InertiaInterface $inertia,
    ) {}

    #[Get('/dashboard')]
    #[Middleware(HandleInertiaRequests::class)]
    public function index(): Response
    {
        return $this->inertia->render('Dashboard', [
            'user' => 'Cheda',
        ]);
    }
}

Development

Devcontainer (recommended)

Open the repo in VS Code and choose Reopen in Container — it will build a PHP 8.5 environment and run composer install automatically. This also works with GitHub Codespaces.

Local setup

Requires PHP 8.5+ and Composer.

git clone https://github.com/chedaroo/inertia-marko.git
cd inertia-marko
composer install

Running tests

composer test

Checking code style

composer format:check

To auto-fix:

composer format

License

MIT