PHPackages                             phpsoftbox/vite - 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. [Framework](/categories/framework)
4. /
5. phpsoftbox/vite

ActiveLibrary[Framework](/categories/framework)

phpsoftbox/vite
===============

Vite integration for the PhpSoftBox framework

077↓90.5%PHP

Since Jun 17Pushed 3w agoCompare

[ Source](https://github.com/phpsoftbox/vite)[ Packagist](https://packagist.org/packages/phpsoftbox/vite)[ RSS](/packages/phpsoftbox-vite/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependenciesVersions (1)Used By (0)

Vite
====

[](#vite)

Минимальный адаптер Vite для генерации тегов скриптов и стилей.

Использование
-------------

[](#использование)

```
$vite = new \PhpSoftBox\Vite\Vite(
    manifestPath: __DIR__ . '/public/build/manifest.json',
    hotFile: __DIR__ . '/public/hot',
    devServer: 'https://vite.domain.local',
    environment: 'dev',
    buildBase: '/build',
    ssrUrl: 'http://node:13714/render',
    ssrEntry: 'resources/js/ssr.tsx',
    ssrTimeout: 2.0,
);

echo $vite->tags('resources/js/app.tsx');
```

Что умеет
---------

[](#что-умеет)

- dev‑сервер: подключает `@vite/client` и entrypoint.
- build‑режим: читает `manifest.json`, подключает JS/CSS, CSS imported chunks и `modulepreload` для статических imports.
- SSR runtime: хранит endpoint SSR-сервера, SSR entrypoint и timeout.

Production manifest
-------------------

[](#production-manifest)

В build-режиме компонент читает manifest, который генерирует Vite. Для каждого entrypoint подключается основной JS-файл, его CSS, CSS статически импортированных chunks и `modulepreload` для этих chunks.

```
echo $vite->tags('resources/js/app.tsx');
```

Если entrypoint импортирует общий bundle, итоговый HTML будет включать примерно такой набор тегов:

```

```

SSR runtime
-----------

[](#ssr-runtime)

Компонент Vite не рендерит Inertia сам. Он хранит runtime-настройки, которые приложение может передать SSR renderer-у:

```
if ($vite->ssrEnabled()) {
    $renderer = new HttpSsrRenderer(
        url: $vite->ssrUrl(),
        timeout: $vite->ssrTimeout(),
    );
}
```

Доступные методы:

- `devServerUrl()` — URL Vite dev-server в dev-режиме или `null`;
- `isDev()` — `true`, если окружение не `prod`;
- `ssrEnabled()` — `true`, если задан SSR endpoint;
- `ssrUrl()` — нормализованный URL SSR endpoint;
- `ssrEntry()` — entrypoint SSR bundle;
- `ssrTimeout()` — timeout HTTP SSR запроса.

Recipe: React + Inertia + ReactSoftBox
--------------------------------------

[](#recipe-react--inertia--reactsoftbox)

Рекомендуемая структура frontend entrypoint:

```
resources/js/app.tsx
resources/js/styles.css
resources/js/Pages/Web/Home.tsx
resources/js/Pages/Admin/Dashboard.tsx
resources/js/Layouts/WebLayout.tsx
resources/js/Layouts/AdminLayout.tsx

```

`resources/js/app.tsx`:

```
import React from 'react';
import { createRoot } from 'react-dom/client';
import { createInertiaApp } from '@inertiajs/react';
import { initTheme } from '@phpsoftbox/react-softbox';
import type { ComponentType } from 'react';
import '@phpsoftbox/react-softbox/foundations/index.css';
import './styles.css';

initTheme({ defaultMode: 'light' });

const pages = import.meta.glob('./Pages/**/*.tsx', { eager: true }) as Record;

createInertiaApp({
  resolve: (name) => {
    const page = pages[`./Pages/${name}.tsx`];
    if (!page) {
      throw new Error(`Page "${name}" not found.`);
    }

    return page.default;
  },
  setup({ el, App, props }) {
    createRoot(el).render();
  },
});
```

`vite.config.js` должен указывать этот entrypoint:

```
export default defineConfig({
  plugins: [react()],
  build: {
    manifest: true,
    rollupOptions: {
      input: 'resources/js/app.tsx',
    },
  },
});
```

Для разделения публичной части и админки используйте Inertia areas: `Web/*` и `Admin/*` остаются в одном frontend entrypoint, а сервер выбирает area по host/path через `InertiaAreaConfig`.

###  Health Score

23

—

LowBetter than 26% of packages

Maintenance62

Regular maintenance activity

Popularity12

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity11

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/0279d150240c97d210034878b0467462246dc14d29b5618157ff6a8be49a50e3?d=identicon)[inspector-who](/maintainers/inspector-who)

---

Top Contributors

[![inspector-who](https://avatars.githubusercontent.com/u/6973963?v=4)](https://github.com/inspector-who "inspector-who (1 commits)")

### Embed Badge

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

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

###  Alternatives

[laravel/dusk

Laravel Dusk provides simple end-to-end testing and browser automation.

1.9k39.6M298](/packages/laravel-dusk)[nineinchnick/edatatables

Grid widget for the Yii Framework, wrapper for the DataTables jQuery plugin

173.2k](/packages/nineinchnick-edatatables)[link-cloud/fast-hyperf

LinkCloud Fast Hyperf

241.2k1](/packages/link-cloud-fast-hyperf)

PHPackages © 2026

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