Show HN: Modern PHP development with Vite, it's ecosystem and PHP components

github.com

4 points by donnikitos a day ago

Over the past months, I’ve been working on somethings scary - bringing modern frontend tooling (Vite, HMR, modular builds) into traditional PHP projects.

This resulted in (currently) three small open-source projects:

- A NPM package for Vite: https://www.npmjs.com/package/vite-plugin-php

- A Packagist package: https://packagist.org/packages/nititech/html-components

- And an additonal NPM package to transpaile those components: https://www.npmjs.com/package/vite-plugin-php-components

The goal is to make PHP feel modern again: fast rebuilds, componentized UI, and zero JS lock-in.

It’s early but already usable — feedback, ideas, and contributions welcome.

Here is a starter repo to play around with: https://github.com/nititech/modern-php-vite-starter

teunlao a day ago

This looks promising for vanilla PHP projects

Two questions:

How does this differ from Laravel's Vite plugin? I'm curious if there are specific advantages for non-framework PHP apps, or if the component system offers something unique.

When a PHP component changes, does it trigger a full page reload or partial re-render of just that component?

  • donnikitos 20 hours ago

    Laravel’s plugin is tightly coupled to Laravel’s build system (Blade, mix manifest, etc.). vite-plugin-php is framework-agnostic — it works with plain PHP or any other custom setup. In comparison: you do not need custom instructions to load assets, supported by Vite or it's plugins. It basically brings the normal Vite dev experience (HMR, asset resolution) to PHP projects.

    The PHP-component system is a simpler way to work with partials and without an additional templating language liek Blade — think of it like JSX, but for PHP. You use JSX like syntax, then it compiles down to normal PHP calls.