PHPackages                             joshcirre/inertiakit - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [File &amp; Storage](/categories/file-storage)
4. /
5. joshcirre/inertiakit

ActiveLibrary[File &amp; Storage](/categories/file-storage)

joshcirre/inertiakit
====================

File-based Inertia routing, simplified server controllers + typed models &amp; props

v0.1.0(2mo ago)510MITPHPPHP ^8.1.0CI failing

Since Apr 25Pushed 2mo ago1 watchersCompare

[ Source](https://github.com/joshcirre/inertiakit)[ Packagist](https://packagist.org/packages/joshcirre/inertiakit)[ RSS](/packages/joshcirre-inertiakit/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (8)Versions (12)Used By (0)

 [![inertiaKIT logo](https://private-user-images.githubusercontent.com/8452303/437608008-98e1a015-11f1-4365-bffb-002e3879debc.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NzU1MTMzNzMsIm5iZiI6MTc3NTUxMzA3MywicGF0aCI6Ii84NDUyMzAzLzQzNzYwODAwOC05OGUxYTAxNS0xMWYxLTQzNjUtYmZmYi0wMDJlMzg3OWRlYmMucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI2MDQwNiUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNjA0MDZUMjIwNDMzWiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9MWE0YTU0MTA4ODhkMGFlZTYxMDFmN2IyODM2ZWExNTgzZmRlZmQ5YTg2YjJiMjgzY2Y2NGE5YzE5NGYzMTE4NSZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.I6warbrcPWnvmaPCcHlc4bU3dYA7bXSvT9acjkiraR4)](https://private-user-images.githubusercontent.com/8452303/437608008-98e1a015-11f1-4365-bffb-002e3879debc.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NzU1MTMzNzMsIm5iZiI6MTc3NTUxMzA3MywicGF0aCI6Ii84NDUyMzAzLzQzNzYwODAwOC05OGUxYTAxNS0xMWYxLTQzNjUtYmZmYi0wMDJlMzg3OWRlYmMucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI2MDQwNiUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNjA0MDZUMjIwNDMzWiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9MWE0YTU0MTA4ODhkMGFlZTYxMDFmN2IyODM2ZWExNTgzZmRlZmQ5YTg2YjJiMjgzY2Y2NGE5YzE5NGYzMTE4NSZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.I6warbrcPWnvmaPCcHlc4bU3dYA7bXSvT9acjkiraR4)

---

inertiaKIT
==========

[](#inertiakit)

inertiaKIT is a zero-boilerplate approach to file-based routing and typed props in Laravel + InertiaJS created by [Josh Cirre](https://joshcirre.com). It auto-generates:

- **Routes** (and optional Controllers) from `resources/js/pages/*.server.php`
- **TypeScript interfaces** for your Eloquent models
- **TypeScript interfaces** for your page props, with camelCased keys and model types

---

Installation
------------

[](#installation)

1. **Require the package**

    ```
    composer require joshcirre/inertiakit
    ```
2. **Install the package**

    ```
    php artisan inertiakit:install
    ```
3. *(Optional but recommended)* **Install Laravel Wayfinder** for zero-config route-action types:

    ```
    composer require laravel/wayfinder
    ```

---

Configuration
-------------

[](#configuration)

Edit your `config/inertiakit.php` to tailor:

```
return [
    // Explicit Eloquent models to type, or empty = auto-discover all under app/Models
    'models'         => [],

    // Where to write your generated TS model interfaces
    'types_output'   => 'resources/js/types/models.d.ts',

    // Generate real Controllers under app/Http/Controllers/Generated
    'use_controllers'=> env('INERTIAKIT_USE_CONTROLLERS', true),

    // Where to dump your auto-generated routes file
    'routes_file'    => 'routes/inertiakit.php',

    // Glob patterns under resources/js/pages to ignore
    'ignore'         => [
        'auth/*',
        'settings/*',
        'welcome',
        'dashboard',
    ],
];
```

---

Usage
-----

[](#usage)

Run the generation command manually once, or run the following as needed:

```
php artisan inertiakit:generate      # Generate routes, controllers, and types
php artisan inertiakit:model-types   # Generate TypeScript types for models
php artisan inertiakit:page-types    # Generate TypeScript types for page props
```

---

Defining Page Data &amp; Actions
--------------------------------

[](#defining-page-data--actions)

Each page pairs a React/Vue/Svelte component with a PHP server file (`.server.php`). Use the fluent `ServerPage` API to define your page:

```
