Zero configuration
The inertia component registers and bootstraps itself. Render your first page with one line in a controller.
The Inertia.js v3 adapter for Yii 2. Build React, Vue or Svelte frontends without writing an API.
use Crenspire\Yii2Inertia\Inertia;
class UserController extends \yii\web\Controller
{
public function actionIndex(): \yii\web\Response
{
return Inertia::render('Users/Index', [
'users' => fn () => User::find()->select(['id', 'name', 'email'])->asArray()->all(),
]);
}
}// src/pages/Users/Index.jsx
export default function Index({ users }) {
return (
<ul>
{users.map((user) => <li key={user.id}>{user.name}</li>)}
</ul>
)
}Continue with the introduction or jump straight to installation.