muhammadanasdevs/laravel-vue-modules

Laravel Vue Module management

v1.0.0 2023-05-28 11:01 UTC

This package is auto-updated.

Last update: 2024-06-04 11:51:38 UTC


README

Software License GitHub all releases

Laravel laravel-modules
10.0 ^1.0.0

muhammadanasdevs/laravel-vue-modules is a Laravel package which created to manage your large Laravel app using modules. Module is like a Laravel package, it has some views, controllers or models. This package is supported and tested in Laravel 10.

Install

To install through Composer, by run the following command:

composer require muhammadanasdevs/laravel-vue-modules

The package will automatically register a service provider and alias.

Optionally, publish the package's configuration file by running:

php artisan vendor:publish --provider="Muhammadanasdevs\Modules\LaravelModulesServiceProvider"

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.

Documentation

You'll find installation instructions and full documentation on https://docs.laravelmodules.com/.

Addition

I only added vue router:

    npm run dev
    npm install vue vue-router vue-axios --save
    npm i @vitejs/plugin-vue
    npm install vuex --save
    php artisan vue-init

add this to web.php

Route::get('{any}', function () {
    return view('welcome');
})->where('any', '.*');

Next, add below script to welcome.blade.php

<!DOCTYPE html>
<html>
    <head>
        @vite('resources/css/app.css')
    </head>
<body>
    <div id="app"></div>
    @vite('resources/js/app.js')
</body>
</html>

Finally, add this to your vite.config.js

import vue from "@vitejs/plugin-vue";

plugins: [
        vue(),
        laravel({
            input: ['resources/css/app.css', 'resources/js/app.js'],
            refresh: true,
        }),
    ],

About Muhammadanasdevs

Muhammadanasdevs is a freelance web developer specialising on the Laravel framework. View all my packages on my website, or visit my LinkedIn.

License

The MIT License (MIT). Please see License File for more information.