PHP code example of ngsoft / php-vite-adapter
1. Go to this page and download the library: Download ngsoft/php-vite-adapter 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/ */
ngsoft / php-vite-adapter example snippets
use NGSOFT\Vite\Adapter\ViteAdapter;
$projectRoot = '/path/to/project/root';
$publicPath = "$projectRoot/public";
$buildDir = "build";
$adapter = new ViteAdapter($projectRoot, $publicPath);
// put your base path there (if public is not /)
// $adapter->setBasePath('/');
// csp policies for some servers
// $adapter->setNonce(sha1(uniqid()));
// if you customized your hot file to not be in public (eg: "$projectRoot/var/cache/hot")
// $adapter->setHotFile($publicPath . '/hot');
// put the endpoint you wish to load (cf: vite.config.ts)
echo $adapter(['src/app.ts'], $buildDir);
shell
composer