vite-php is a lightweight library for integrating Vite built assets with any PHP application.
By parsing Vite’s manifest.json, it resolves asset URLs and generates the required <script> and <link> tags.
HMR is supported through automatic hot file detection, enabling a seamless development workflow.
composer require webtimal/vite-php<?php
use Webtimal\Vite\Vite;
$vite = new Vite(
// Path to the manifest.json file
manifest: __DIR__ .'/dist/manifest.json',
// Public base path or URL
base: '/dist',
// Optional path to the hot file, containting the dev server URL
hotfile: __DIR__ .'./hot'
);<!DOCTYPE html>
<html lang="en">
<head>
<?php $vite(['css/style.css', 'js/script.js']); ?>
...This library is open-sourced software licensed under the MIT License.