donnikitos / vite-plugin-php Goto Github PK
View Code? Open in Web Editor NEWVite's speed and tooling to preprocess PHP-files!
Home Page: https://www.npmjs.com/package/vite-plugin-php
License: MIT License
Vite's speed and tooling to preprocess PHP-files!
Home Page: https://www.npmjs.com/package/vite-plugin-php
License: MIT License
how to use this plugin
Hi, Should this be hot reloading automatically?
When I edit the index.php file the page does not hot reload automatically.
Vite output in CLI does notice the change and outputs this:
3:35:24 pm [vite] page reload src/index.php
System:
Linux Mint 21.2
LAMP server with Lando based in Docker.
PHP 8.1
Vite v4.5.0
Node v18.17.1
Running dev server
npm run dev
Loading autoloader from vendor folder:
/**
* Autoloader.
*/
require_once __DIR__ . '/../vendor/autoload.php';
The page keeps reloading and never stops, so the page never appears to reflect changes.
I guess the plugin tries to escape this folder too, is there any way to ignore it?
The production build works fine though.
Hi, I'm trying wildcards and they don't work.
plugins: [
usePHP({
entry: [
"index.php",
"partials/*.php",
]
})
],
I have to define each file to make it work:
plugins: [
usePHP({
entry: [
"index.php",
"partials/nav-top.php",
"partials/message.php",
"partials/footer.php",
]
})
],
Is it possible to use wildcards in entries?
Thanks.
When I use import in a PHP script to import another PHP script it doesn't work locally (it works after building though).
I have index.php
:
<?php
include '/config.php';
echo $test
?>
and config.php
:
<?php
define("test", "testing");
?>
vite.config.ts
:
import usePHP from 'vite-plugin-php';
export default defineConfig({
plugins: [usePHP({ binary: '/opt/homebrew/bin/php', entry: ['index.php', 'config.php', 'get-access/index.php'],})],
});
When opening the page I get this error:
Warning: include(/config.php): Failed to open stream: No such file or directory in /Users/martinhell/Documents/quantumcode/slaice-website/node_modules/vite-plugin-php/dist/router.php(14) : eval()'d code on line 17
Warning: include(): Failed opening '/config.php' for inclusion (include_path='.:/opt/homebrew/Cellar/php/8.2.12_1/share/php/pear') in /Users/martinhell/Documents/quantumcode/slaice-website/node_modules/vite-plugin-php/dist/router.php(14) : eval()'d code on line 17
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.