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

vite-php-manifest

v0.1.1

Published

A simple Vite 6+ plugin generate a PHP manifest.

Readme

Features

  • Converts manifest.json to a PHP file.
  • Supports filtering and grouping of manifest items/chunks.
  • Allows customization of PHP file formatting (line breaks, indentation, short array syntax).

Installation

Install it via npm:

npm install vite-php-manifest --save-dev

Or with yarn:

yarn add -D vite-php-manifest

Usage

Add the plugin to your vite.config.js file:

import { defineConfig } from 'vite';
import { VitePhpManifest } from 'vite-php-manifest';

export default defineConfig({
  plugins: [VitePhpManifest()],
});

or with plugin options (optional)

import { defineConfig } from 'vite';
import { VitePhpManifest } from 'vite-php-manifest';

export default defineConfig({
  plugins: [
    VitePhpManifest({
      filter: (originalFileName, manifestChunk) => {
        manifestChunk.myCustomKey = 'my-custom-value';
        return manifestChunk;
      },
      group: {
        js: ['js', 'jsx'],
        css: ['css'],
        images: ['png', 'jpg', 'jpeg', 'gif'],
        svg: ['svg'],
      },
      linebreak: '\n',
      indent: '    ',
      shortArraySyntax: true,
      unlinkOriginManifest: false,
      manifestFile: 'vite/manifest.php',
    }),
  ],
});

Options

filter (default: false)

Type: false | (originalFileName: string, manifestChunk: ManifestChunk) => ManifestChunk | null

A function to filter chunks in the manifest. If false, no filtering is applied.

Example:

filter: (originalFileName, manifestChunk) => {
  if (manifestChunk.isEntry) {
    manifestChunk.customEntryKey = 'custom-value';
  }
  return manifestChunk;
};

group (default: false)

Type: false | Record<string, string[]> | (originalFileName: string, manifestChunk: ManifestChunk) => string

A function to group chunks in the PHP manifest. Can be an object mapping group names to file extensions or a callback function.

Example (Object Mapping):

 group: {
    js: ['js', 'jsx'],
    css: ['css'],
    images: ['png', 'jpg', 'jpeg', 'gif'],
    svg: ['svg']
},

Example (Callback Function):

group: (originalFileName, manifestChunk) => {
  return originalFileName.endsWith('.css') ? 'styles' : 'scripts';
},

defaultGroup (default: 'other')

Type: string

The default group name for chunks that do not match any group when using object mapping.

unlinkOriginManifest (default: true)

Type: boolean

If true, deletes the original manifest.json after generating the PHP file.

manifestFile (default: 'manifest.php')

Type: string

The output path for the generated PHP manifest file relative to the outDir.

linebreak (default: '\n')

Type: string

The line break character(s) to use in the PHP manifest file.

indent (default: ' ')

Type: string

The indentation character(s) to use in the PHP manifest file.

shortArraySyntax (default: false)

Type: boolean

Whether to use PHP's short array syntax ([]).

Example Output

Given the following manifest.json:

{
  "main.js": {
    "file": "assets/main-1234.js",
    "isEntry": true
  },
  "styles.css": {
    "file": "assets/styles-5678.css",
    "isEntry": false
  }
}

The plugin generates the following manifest.php:

<?php
  return array(
    'main.js' => array(
      'file' => 'assets/main-1234.js',
      'isEntry' => true,
    ),
    'styles.css' => array(
      'file' => 'assets/styles-5678.css',
      'isEntry' => false,
    ),
  );