PHPackages                             builtnoble/vite-php - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Templating &amp; Views](/categories/templating)
4. /
5. builtnoble/vite-php

ActiveLibrary[Templating &amp; Views](/categories/templating)

builtnoble/vite-php
===================

Use Vite with PHP templating engines like Twig, Plates, and Laminas View.

v0.1.0(6mo ago)03MITPHPPHP ^8.3 || ~8.4.0

Since Nov 5Pushed 6mo agoCompare

[ Source](https://github.com/builtnoble/vite-php)[ Packagist](https://packagist.org/packages/builtnoble/vite-php)[ RSS](/packages/builtnoble-vite-php/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (6)Versions (3)Used By (0)

Vite Manifest Reader for PHP
============================

[](#vite-manifest-reader-for-php)

 [![StyleCI](https://camo.githubusercontent.com/0fc20900cd2951b2fe369a8748b1b631bc488cca7a46e0b7bdb80dd38e33ed6a/68747470733a2f2f6769746875622e7374796c6563692e696f2f7265706f732f313037383433303234372f736869656c643f6272616e63683d6d61696e)](https://github.styleci.io/repos/1078430247?branch=main)

---

Laravel provides an excellent built-in Vite integration through its Vite class but, for developers working outside of Laravel’s ecosystem, there’s a gap.

This package aims to fill that gap, making it easy to integrate Vite into standalone PHP applications, micro-frameworks, or custom setups while keeping a clean and familiar workflow.

It reads Vite’s `manifest.json` file, resolves asset URLs, and outputs the correct `` and `` tags for both development and production environments.

While it can be used on its own, it’s primarily intended as a core utility for framework-agnostic Vite integrations — for example, as part of a [Plates](https://platesphp.com/) or [Twig](https://twig.symfony.com/) extension.

---

Usage
-----

[](#usage)

Install via composer:

```
composer require builtnoble/vite-php
```

Then, use it in your PHP code:

```
use Builtnoble\VitePHP\ViteFactory;
use Random\RandomException;

// Basic usage (standalone):
// Build a configured Vite instance and invoke it with an array of asset paths.
// Passing 'nonce' => null requests a generated nonce (may throw RandomException).
try {
    $vite = ViteFactory::make([
        'hotfile' => '/tmp/vite-dev-server',
        'buildDir' => 'dist',
        'publicPath' => 'public',
        'manifestFilename' => 'manifest.json',
        'integrityKey' => 'my_integrity_key',
        'nonce' => null, // pass null to generate a random nonce
    ]);

    // invoke Vite with an array of asset paths; the invokable returns the rendered tags/HTML
    echo ($vite)([
        'resources/css/app.css',
        'resources/js/app.js',
    ]);
} catch (RandomException $e) {
    // handle nonce generation failure
    throw $e;
}

// Advanced: provide a custom creator and attribute resolvers
$customCreator = function (): Builtnoble\VitePHP\Vite {
    $v = new Builtnoble\VitePHP\Vite();
    $v->setBuildDir('custom-dist');
    return $v;
};

$vite = ViteFactory::make([
    'scriptTagAttributesResolvers' => [
        // resolver receives (string $path, ?array $manifestEntry) and returns attributes
        function (string $path, array $entry = null): array {
            return ['defer' => true];
        },
    ],
    'styleTagAttributesResolvers' => function (string $path, array $entry = null): array {
        return ['media' => 'all'];
    },
], $customCreator);

// invoke with specific assets
echo ($vite)([
    'resources/js/app.js',
]);
```

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance67

Regular maintenance activity

Popularity3

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity44

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 90.2% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

195d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/af732f19ad0ee759414fb9ab5c9fb128fc5bef6cf2c39273207991e45b32f033?d=identicon)[mandicap](/maintainers/mandicap)

---

Top Contributors

[![mandicap](https://avatars.githubusercontent.com/u/2105550?v=4)](https://github.com/mandicap "mandicap (37 commits)")[![StyleCIBot](https://avatars.githubusercontent.com/u/11048387?v=4)](https://github.com/StyleCIBot "StyleCIBot (4 commits)")

---

Tags

phptwigviteplateslaminas-viewtemplating engine

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/builtnoble-vite-php/health.svg)

```
[![Health](https://phpackages.com/badges/builtnoble-vite-php/health.svg)](https://phpackages.com/packages/builtnoble-vite-php)
```

###  Alternatives

[goetas/twital

PHP templating engine that combines Twig and PHPTal power points

12813.1k1](/packages/goetas-twital)[picocms/pico-composer

Pico is a flat file CMS, this means there is no administration backend and database to deal with. You simply create .md files in the "content" folder and that becomes a page.

2020.6k](/packages/picocms-pico-composer)[goetas/twital-bundle

Twital templating engine Symfony Bundle

206.8k](/packages/goetas-twital-bundle)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
