PHPackages                             toanld/modules-inertia - 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. [Framework](/categories/framework)
4. /
5. toanld/modules-inertia

ActiveLibrary[Framework](/categories/framework)

toanld/modules-inertia
======================

Relationship Vue/InertiaJs with modular structure Laravel-Modules

1.3.1(1y ago)141.8k↓33.3%61MITPHPPHP &gt;=7.4.0

Since Feb 28Pushed 1y agoCompare

[ Source](https://github.com/toanld/modules-inertia)[ Packagist](https://packagist.org/packages/toanld/modules-inertia)[ RSS](/packages/toanld-modules-inertia/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (2)Dependencies (5)Versions (9)Used By (1)

Modules-Inertia
===============

[](#modules-inertia)

[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)

The package is designed to be used by Vue/InertiaJs in conjunction with [Laravel-Modules](https://github.com/nWidart/laravel-modules)

Laravel compatibility
---------------------

[](#laravel-compatibility)

Laravelmodules-inertia6.0-10.x0.0.xInstallation
------------

[](#installation)

**Install the package via composer.**

```
composer require toanld/modules-inertia
```

Config Files
------------

[](#config-files)

**In order to edit the default configuration you may execute:**

```
php artisan vendor:publish --provider="Dongrim\ModulesInertia\ModulesInertiaServiceProvider"

```

Autoloading
-----------

[](#autoloading)

**By default, the module classes are not loaded automatically. You can autoload your modules using psr-4.****For example:**

```
{
  "autoload": {
    "psr-4": {
      "App\\": "app/",
      "Modules\\": "Modules/",
      "Database\\Factories\\": "database/factories/",
      "Database\\Seeders\\": "database/seeders/"
  }

}
```

**Tip: don't forget to run `composer dump-autoload` afterwards.**

Routing
-------

[](#routing)

**Module routes must contain middleware in your App\\Http\\Kernel, as the last item in your web middleware group.**

```
'web' => [
    // ...
    \App\Http\Middleware\HandleInertiaRequests::class,
],
```

Usage
-----

[](#usage)

**By default, Vue module files are created in the module directory Resources/Pages**

**You can change the default directory in config/modules.php**

```
 'Pages/Index' => 'Resources/Pages/Index.vue',
 //...
 'source' => 'Resources/Pages',
```

### For use in Controller

[](#for-use-in-controller)

**The default value of Inertia::render() in a module has been changed to Inertia::module().**

**Inertia::render() is still available by default. It can be used outside of modules**

- `module_name` - real name of the current module
- `file_name` - real name of the file (no extension .vue)
- `directory_name` - if you have nested display folder structure ( you can specify the file path separating by a dot )

**For example:**

```
    public function some_method()
    {
        return Inertia::module('module_name::file_name');
        //
        return Inertia::module('module_name::file_name', ['data'=>'some data']);
        //
        return Inertia::module('module_name::directory_name.file_name', ['data'=>'some data']);
    }
```

### If you use Vue version 2

[](#if-you-use-vue-version-2)

```
import Vue from "vue";
import { createInertiaApp, Link } from "@inertiajs/inertia-vue";

createInertiaApp({
    resolve: (name) => {
        let page = null;

        let isModule = name.split("::");
        if (isModule.length > 1) {
            let moduleName = isModule[0];
            let pathToFile = isModule[1];
            // @modules is an alias of the module folder or just specify the path
            // from the root directory to the folder modules
            // for example ../../modules
            page = require(`@modules/${moduleName}/${pathToFile}.vue`);
        } else {
            page = require(`./Pages/${name}`);
        }

        return page.default;
    },
    setup({ el, App, props, plugin }) {
        Vue.use(plugin);

        new Vue({
            render: (h) => h(App, props),
        }).$mount(el);
    },
});
```

### If you use Vue version 3

[](#if-you-use-vue-version-3)

```
import { createApp, h } from "vue";
import { createInertiaApp } from "@inertiajs/inertia-vue3";

createInertiaApp({
    resolve: (name) => {
        let page = null;

        let isModule = name.split("::");
        if (isModule.length > 1) {
            let module = isModule[0];
            let pathTo = isModule[1];
            // @modules is an alias of the module folder or just specify the path
            // from the root directory to the folder modules
            // for example ../../modules
            page = require(`@modules/${moduleName}/${pathToFile}.vue`);
        } else {
            page = require(`./Pages/${name}`);
        }
        //...
        return page.default;
    },
    setup({ el, App, props, plugin }) {
        createApp({ render: () => h(App, props) })
            .use(plugin)
            .mount(el);
    },
});
```

Aliases
-------

[](#aliases)

**For the convenience of specifying the path from the root directory to the module directory, you can add alias in webpack.mix.js**

```
const path = require('path')

mix.webpackConfig((webpack) => {
  return {
    resolve: {
       alias: {
         "@modules": path.resolve(__dirname + "/modules"),
       },
    },
  };
});
```

**For the convenience of specifying the path from the root directory to the module directory, you can add alias in vite.config.js**

```
const path = require('path')

export default defineConfig({
  resolve:{
    alias:{
      '@modules' : path.resolve(__dirname + '/modules')
    },
  }
})
```

Console command
---------------

[](#console-command)

**You can run `php artisan module:publish-stubs` to publish stubs.**

**And override the generation of default files**

After create module
-------------------

[](#after-create-module)

**To be VueJS able to find the created module, you need to rebuild the script**

```
npm run dev
```

Documentation
-------------

[](#documentation)

You'll find installation instructions and full documentation on .

Authors
-------

[](#authors)

- [Nicolas Widart](https://github.com/nWidart/)
- [Yaroslav Fedan](https://github.com/YaroslavFedan/)
- Add your clickable username here. It should point to your GitHub account.

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

33

—

LowBetter than 75% of packages

Maintenance31

Infrequent updates — may be unmaintained

Popularity29

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity50

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 79.5% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~64 days

Recently: every ~70 days

Total

8

Last Release

718d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/b884bdad7cead7cd70b807b4c4f3453d6eee6f4e7e8326b42a799553fb63eb9c?d=identicon)[toanld1905](/maintainers/toanld1905)

---

Top Contributors

[![YaroslavFedan](https://avatars.githubusercontent.com/u/8318982?v=4)](https://github.com/YaroslavFedan "YaroslavFedan (35 commits)")[![toanld](https://avatars.githubusercontent.com/u/33773069?v=4)](https://github.com/toanld "toanld (9 commits)")

---

Tags

phplaravelnwidartinertiajsvuelaravel-modules

###  Code Quality

TestsPHPUnit

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/toanld-modules-inertia/health.svg)

```
[![Health](https://phpackages.com/badges/toanld-modules-inertia/health.svg)](https://phpackages.com/packages/toanld-modules-inertia)
```

###  Alternatives

[mhmiton/laravel-modules-livewire

Using Laravel Livewire in Laravel Modules package with automatically registered livewire components for every modules.

236409.6k9](/packages/mhmiton-laravel-modules-livewire)[titasgailius/laravel-moonlight

An elegant Laravel scaffolding for your next single-page application.

1446.6k](/packages/titasgailius-laravel-moonlight)[kompo/kompo

Laravel &amp; Vue.js FullStack Components for Rapid Application Development

11812.4k21](/packages/kompo-kompo)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
