highliuk / vite
Parse Vite.js manifest file easily and print tags in PHP to enjoy HMR
1.0.1
2024-04-18 20:30 UTC
Requires
None
Requires (Dev)
- phpstan/phpstan: ^1.10
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
This library allows you to parse Vite.js manifest files easily and print tags in PHP to enjoy Hot Module Replacement (HMR).
Installation
Use composer to install the package:
composer require highliuk/vite
Usage
use HighLiuk\Vite\Vite; use HighLiuk\Vite\Manifest; $manifest = new Manifest('/path/to/dist/', '/url/to/dist/'); $vite = new Vite($manifest); // print the tags echo $vite->tags();
In this example, replace /path/to/dist with the path to your Vite.js dist directory and /url/to/dist with the URL to your Vite.js dist directory.
You can also specify the Vite host and port (defaults to http://localhost:5173/):
$vite = new Vite($manifest, 'http://localhost:port/');
Example
See the example directory for a full example.
License
This project is licensed under the MIT License - see the LICENSE file for details.