PHP code example of chianglintu / spiral-vite-bridge

1. Go to this page and download the library: Download chianglintu/spiral-vite-bridge 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/ */

    

chianglintu / spiral-vite-bridge example snippets


use Spiral\Vite\Bootloader\ViteBootloader;

ViteBootloader::class,

@viteReactRefresh
@viteFonts()
@vite(['app/resources/css/fonts.css', 'app/resources/css/app.css', 'app/resources/js/app.ts'])
@viteAsset('app/resources/images/logo.svg')

use Spiral\Vite\Vite;

$vite->tags('app/resources/js/app.ts');
$vite->asset('app/resources/images/logo.svg');
$vite->withNonce($nonce)->tags('app/resources/js/app.ts');
$vite->useCspNonce();
$vite->useScriptTagAttributes(['data-turbo-track' => 'reload']);
$vite->useStyleTagAttributes(['data-turbo-track' => 'reload']);
$vite->useIntegrityKey('custom-integrity');
$vite->createAssetPathsUsing(fn(string $path): string => "https://cdn.example.com/{$path}");
$vite->prefetch(concurrency: 3, event: 'load');
$vite->useAggressivePrefetching();
$vite->useFontsManifestFilename('fonts-manifest.json');
$vite->asset('app/resources/images/logo.svg', buildDirectory: 'admin-build');
$vite->content('app/resources/snippet.txt', buildDirectory: 'admin-build');
$vite->manifestHash(buildDirectory: 'admin-build');
$vite->toHtml();
$vite->flush();
bash
cp vendor/chianglintu/spiral-vite-bridge/config/vite.php app/config/vite.php
text
app/config/vite.php