php-forge / vite
Framework-agnostic PHP integration for Vite development servers and build manifests
Fund package maintenance!
Requires
- php: >=8.3
- php-forge/debug: ^0.1
- psr/event-dispatcher: ^1.0
- ui-awesome/html: ^0.6
Requires (Dev)
- infection/infection: ^0.35
- maglnet/composer-require-checker: ^4.1
- php-forge/coding-standard: ^0.3
- phpstan/extension-installer: ^1.4
- phpstan/phpstan: ^2.2
- phpstan/phpstan-phpunit: ^2.0
- phpstan/phpstan-strict-rules: ^2.0.3
- phpunit/phpunit: ^12.5
- xepozz/internal-mocker: ^1.4
Suggests
None
Provides
None
Conflicts
None
Replaces
None
This package is auto-updated.
Last update: 2026-09-11 19:58:43 UTC
README
Vite
A framework-agnostic PHP integration for resolving Vite development and production assets.
Features
Installation
composer require php-forge/vite:^0.3
The consuming application owns Vite and every JavaScript dependency. Production resolution needs Vite's build
manifest; see Installation for the vite.config.js settings and the resulting manifest path.
Quick start
Development
use PHPForge\Vite\Configuration\DevelopmentConfiguration; use PHPForge\Vite\Html\HtmlRenderer; use PHPForge\Vite\Vite; $vite = Vite::create( DevelopmentConfiguration::create( devServerUrl: 'http://localhost:5173', ), entrypoints: ['resources/js/app.js'], ); echo HtmlRenderer::create()->render($vite->resolve());
Production
use PHPForge\Vite\Configuration\ProductionConfiguration; use PHPForge\Vite\Html\HtmlRenderer; use PHPForge\Vite\Vite; $vite = Vite::create( ProductionConfiguration::create( manifestPath: '/srv/app/public/build/.vite/manifest.json', assetBaseUrl: '/build', ), entrypoints: ['resources/js/app.js'], ); echo HtmlRenderer::create()->render($vite->resolve());
Debugger integration
Vite::resolve() emits AssetsResolved through an optional PSR-14 dispatcher. The asset resolution path never
imports a debug contract or calls a collector, so installing the package does not activate a debugger and a call
without a dispatcher emits no events. The collector and panel that do implement those contracts live apart, in
PHPForge\Vite\Debug, owned by this package.
See Debugger integration for the Yii2 and Yii3 wiring. It remains an unreleased prototype.
Yii2
Yii3
Documentation
- Installation guide
- Configuration reference
- Manifest resolution
- Usage examples
- Security and CSP
- Debugger integration
- Testing guide