DEV Community

Rajen Trivedi
Rajen Trivedi

Posted on

Convert your normal Laravel Application in to SPA

I have recently published my first laravel package named laravel-spa, which is developed using javascript library turbolinks.

You can use this package in any normal laravel application, the installation & configuration process is very easy, you just have to run below artisan command on the root of your project.

composer require rajentrivedi/laravel-spa

After successful installation, you need to use below blade directive in your master blade, normally where we load all the assets.

@spa

Your javascript code or jQuery code should be between these blade directives.

@spascrit & @endspascript

If you want to disable this package for certain route, you can use

@disablespa

Example
<a href="{{route('excel.download')}}" class="btn btn-primary btn-md m-5" @disablespa>Excel</a>

Now, page load speed of your application is faster compare to normal application.

Github link

Top comments (0)