PHP code example of robertboes / sidecar-inertia-vite

1. Go to this page and download the library: Download robertboes/sidecar-inertia-vite library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

robertboes / sidecar-inertia-vite example snippets


namespace App\Providers;

use RobertBoes\SidecarInertiaVite\SidecarGateway;
use Illuminate\Support\ServiceProvider;
use Inertia\Ssr\Gateway;

class AppServiceProvider extends ServiceProvider
{
    public function register()
    {
        // Use Sidecar to run Inertia SSR.
        $this->app->instance(Gateway::class, new SidecarGateway);
    }
}



return [
    'functions' => [
        \RobertBoes\SidecarInertiaVite\SSRFunction::class,
    ],
    
    // ...
];
shell
php artisan vendor:publish --provider="RobertBoes\SidecarInertiaVite\ServiceProvider" --tag="config"
shell
php artisan sidecar:install
shell
php artisan sidecar:configure