1. Go to this page and download the library: Download responsive-sk/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/ */
responsive-sk / vite example snippets
use ResponsiveSk\Vite\ViteService;
use ResponsiveSk\Vite\TwigExtension;
use Slim4\Root\PathsInterface;
// In your container definitions
$container->set(ViteService::class, function ($container) {
$paths = $container->get(PathsInterface::class);
$isDev = $_ENV['APP_ENV'] === 'development';
// Basic configuration
return new ViteService($paths, 'build', $isDev);
// Advanced configuration with custom asset directories
/*
return new ViteService(
$paths,
'build',
$isDev,
'http://localhost:5173',
[
'images' => 'assets/images',
'fonts' => 'assets/fonts',
]
);
*/
});
// Register Twig extension
$container->extend(Twig::class, function ($twig, $container) {
$viteService = $container->get(ViteService::class);
$twig->addExtension(new TwigExtension($viteService));
return $twig;
});
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.