npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@jts-studios/vite-plugin-php

v1.4.1

Published

Vite plugin for PHP projects — hot reload, HTML minification, and PHP build integration.

Readme

@jts-studios/vite-plugin-php

vite-plugin-php is an all-in-one solution for PHP projects with Vite.

How It Works

The plugin automatically manages your PHP workflow across three phases:

  • Dev server: Automatically starts a PHP server, picks an available port, proxies requests to it, and injects the Vite HMR client.
  • Hot update — triggers full-page reloads on .php changes and CSS hot-swaps on stylesheet changes
  • Build — processes each PHP entry: minifies HTML, restores tokenised PHP blocks from .json fragments, outputs final .php files to dist/

Installation

npm install @jts-studios/vite-plugin-php

Usage

// vite.config.js
import { PHP } from "@jts-studios/vite-plugin-php"

export default {
    plugins: [
        PHP({
            entries: ["pages/index.php", "pages/about.php"],
            verbose: false,
            minifyHtml: true,
            hotReload: true,
        }),
    ],
}

Options

| Option | Type | Default | Description | |---|---|---|---| | entries | string[] | required | PHP entry files or folders to process | | verbose | boolean | false | Enable detailed build logging | | minifyHtml | boolean | true | Minify HTML output via html-minifier-terser | | hotReload | boolean | true | Enable hot reload for PHP and CSS changes | | autoStartPhp | boolean | true | Start the PHP built-in server automatically in dev | | phpHost | string | "127.0.0.1" | Host used by the auto-started PHP server | | phpPort | number | auto (starts at 3000) | Port for PHP server; if omitted, first free port is chosen | | phpCommand | string | "php" | PHP executable command used to start the server | | router | string \| null | null | Front controller to route dev requests through, e.g. "index.php". See below | | redirects | {from,to}[] | [] | Permanent redirects your web server does, replayed in dev. Needs router |

Routing in dev

Without router, the dev server only resolves paths that exist on disk. /pages/about.php works; /about does not — even though that is the URL production serves, and the one every link in your markup points at.

Set router to your front controller and dev behaves like the real thing:

PHP({
    entries: ["pages"],
    router: "index.php",
})

Two things change. PHP starts with a generated router script that defers to your front controller, so a URL resolves in dev exactly the way it resolves live — not through a second copy of your routing rules that has to be kept in step. And Vite switches to appType: "custom", so anything Vite does not recognise goes to PHP instead of being answered with index.html.

That covers POST as well, which the prefix proxy never forwarded: form handlers, JSON endpoints and webhook receivers all work.

redirects is for rules that live in your web server rather than your application — a renamed route still forwarding its old path, say. The front controller never sees those, so dev would 404 what production forwards:

redirects: [{ from: "^/old_name/?$", to: "/new-name" }]

from is a regex against the path, $1 in to works, and the query string is carried over.

Both are off by default, because turning them on changes what every unmatched path does — a surprise in a project that already works.