muhammadanasdevs / laravel-vue-modules
Laravel Vue Module management
Fund package maintenance!
muhammadanasdevs
Requires
- php: >=8.1
- ext-json: *
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.6
- laravel/framework: ^10.0
- mockery/mockery: ^1.5
- orchestra/testbench: ^8.0
- phpstan/phpstan: ^1.4
- phpunit/phpunit: ^10.0
- spatie/phpunit-snapshot-assertions: ^5.0
README
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.