PHP code example of mindplay / php-vite

1. Go to this page and download the library: Download mindplay/php-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/ */

    

mindplay / php-vite example snippets


$vite = new Manifest(
    manifest_path: $your_root_dir . '/public/dist/.vite/manifest.json',
    base_path: '/dist/',
    dev: false
);

$tags = $vite->createTags("index.ts");

$tags = $vite->createTags("index.ts", "consent-banner.ts");

$manifest->preloadImages();
$manifest->preloadFonts();

$manifest->preload(
    ext: "json",
    mime_type: "application/json",
    preload_as: "fetch"
);

$my_url = $manifest->getURL("consent-banner.ts");