https://github.com/nititech/vite-plugin-php-components
https://github.com/nititech/vite-plugin-php-components
php php-framework php-library vite vite-php vite-plugin web webdev webdevelopment
Last synced: about 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/nititech/vite-plugin-php-components
- Owner: nititech
- License: mit
- Created: 2025-10-25T09:08:53.000Z (8 months ago)
- Default Branch: master
- Last Pushed: 2026-03-29T19:57:13.000Z (3 months ago)
- Last Synced: 2026-03-29T21:34:05.261Z (3 months ago)
- Topics: php, php-framework, php-library, vite, vite-php, vite-plugin, web, webdev, webdevelopment
- Language: TypeScript
- Homepage: https://www.npmjs.com/package/vite-plugin-php-components
- Size: 25.4 KB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# vite-plugin-php-components
[](https://www.npmjs.com/package/vite-plugin-php-components)  [](https://github.com/nititech/vite-plugin-php-components/blob/master/LICENSE)
 [](https://github.com/nititech/vite-plugin-php-components/issues)
A Vite plugin to transpile [PHP-Components](https://packagist.org/packages/nititech/html-components) into pure PHP calls.\
This plugin is intended to be used with [vite-plugin-php@>=3.0.0-beta](https://www.npmjs.com/package/vite-plugin-php) and [PHP-Components](https://packagist.org/packages/nititech/html-components)
```ts
// vite.config.js
import { defineConfig } from 'vite';
import usePHP from 'vite-plugin-php';
import transpilePHPComponents from 'vite-plugin-php-components';
export default defineConfig({
plugins: [
transpilePHPComponents(), // This plugin must be defined before the vite-plugin-php call
usePHP(),
],
});
```
## What does this plugin do?
The [PHP-Components](https://packagist.org/packages/nititech/html-components) package on Packagist allows you to define class based components, similar to those in React.\
This plugin transpiles these HTML or React like structured components into the appropriate PHP class calls.
In the end you would have something like this in your code base:
```php
/* Some *.php file */?>
```
This code will be transpiled during dev and build into code similar to this:
```php
/* Some *.php file */?>
'O-la-la', 'search' => $_GET['search']]); ?>
Go to home
close(); ?>
close(); ?>
```
## Props spreading
Since version 0.0.92 you have the possibility to spread props into a component!
```php
Noice!
```
This is especially useful if you want to pass down properties from a parent component:
```php
| 