bionicmaster / laravel-nuxt
Build a SPA with Laravel and Nuxt
2.0.0
2020-12-05 22:32 UTC
Requires
- php: >=7.0.0
- laravel/framework: 5.5.*|5.6.*|5.7.*|5.8.*|6.*|7.*|8.*
This package is auto-updated.
Last update: 2025-03-06 07:49:22 UTC
README
This package allows you to build a SPA with Laravel and Nuxt.
Installation
composer require pallares/laravel-nuxt
In Laravel 5.5 the service provider will automatically get registered. In older versions of the framework just add the service provider in config/app.php
file:
return [ // ... 'providers' => [ // ... Pallares\LaravelNuxt\LaravelNuxtServiceProvider::class, ], ];
You need to add a fallback route that will render the SPA page in routes/web.php
file:
// ... // Add this route the last, so it doesn't interfere with your other routes. Route::get( '{uri}', '\\'.Pallares\LaravelNuxt\Controllers\NuxtController::class )->where('uri', '.*');
Finally, you must install the laravel-nuxt npm package. After following the instructions, run npm run build
and try your SPA!