Home Arrow Icon Knowledge base Arrow Icon Global Arrow Icon Protonemedia/laravel-splade
    Laravel Splade Single Page Applications Blade templates Vue 3 components Laravel middleware PHP framework SPA development


Protonemedia/laravel-splade


Laravel Splade is a powerful package that provides a super easy way to build Single Page Applications (SPAs) using standard Laravel Blade templates, enhanced with renderless Vue 3 components[4]. It allows you to use the simplicity of Blade to write your app, while still providing the magic SPA-feeling and interactivity of Vue.js[4].

To install Laravel Splade, you can use Composer[1]:

bash
composer require protonemedia/laravel-splade

Then, add the Route Middleware to the `Http/Kernel.php` file[1]:

php
class Kernel extends HttpKernel{
    protected $routeMiddleware = [
        'splade' => \ProtoneMedia\Splade\Http\SpladeMiddleware::class,
    ];
}

In your routes file (typically `web.php`), you can use the Middleware[1]:

php
Route::middleware('splade')->group(function () {
    Route::view('/', 'welcome');
    Route::view('/contact', 'contact');
});

Finally, in the `register` method of the `Exceptions/Handler.php` file, you need to register Splade's Exception Handler[1]:

php
use ProtoneMedia\Splade\SpladeCore;

class Handler extends ExceptionHandler{
    public function register() {
        $this->renderable(SpladeCore::exceptionHandler($this));
    }
}

Laravel Splade provides a wide range of features, including[4]:

- Automatic installer and support for the Laravel Breeze starter kit
- More than 20 interactive components
- Built-in support for Modals, Slideovers, and DataTables-like Tables
- Lazy Loading, Persistent Layout, Animations, and Teleports
- Laravel Echo integration
- Built-in SEO support
- Support for custom Blade and Vue components, existing Blade and Vue libraries, and SSR (server-side rendering)

The package is actively maintained by Pascal Baljet and the Protone Media team[5]. It has been downloaded over 45,000 times and has 1,259 stars on GitHub[5].

Citations:
[1] https://splade.dev/docs/manual-installation
[2] https://packagist.org/packages/protonemedia/laravel-splade-breeze
[3] https://github.com/protonemedia/laravel-splade-breeze
[4] https://github.com/protonemedia/laravel-splade
[5] https://www.larablocks.com/package/protonemedia/laravel-splade