Download the PHP package chialab/vite-cakephp without Composer

On this page you can find all versions of the php package chialab/vite-cakephp. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package vite-cakephp

Vite plugin for CakePHP

A Vite plugin and CakePHP helper that connect a Vite build to a CakePHP application. The plugin produces a single JSON manifest that the helper reads to emit the correct <script> and <link> tags in both development and production.

Requirements

Dependency Version
PHP ≥ 8.3
CakePHP ^4.5
Vite ^6.0

Installation

The Vite plugin ships inside the Composer package — no separate npm install is needed.

Setup

1. Bootstrap the plugin

2. Load the helper

Pass configuration options as the second argument if the defaults do not match your project layout (see PHP helper options):

3. Configure Vite

Usage

Call js() and css() independently in your layout or view templates. The logical entry name is {group.name}/{entry}:

Both methods return an empty string when the manifest file is absent (no dev server running, no build present), so they are always safe to call.

CSS-only and JS+CSS entries


Configuration reference

Vite plugin options

vitePhp(inputs: BuildGroup[]) accepts an array of build groups.

BuildGroup

Each group maps to one Rollup build with its own output directory, public URL, and entry files.

Field Type Default Description
name string Namespace prefix for logical entry names, e.g. "app".
inputs Record<string, EntryInput> Local entry name → source file mapping (see below).
outDir string Output directory for this group's assets, relative to the project root.
publicPath string Public URL base where outDir is served (baked into the manifest paths).
format "es" \| "iife" "es" Build format. "iife" produces a self-contained bundle suitable for file:// pages.
external string[] [] External module IDs (meaningful for "iife" groups).

EntryInput

Each entry in inputs can be written in two ways:

Multiple groups example

Logical names for the above: app/home, app/product, app/styles, embed/widget.


PHP helper options

Option Type Default Description
buildPath string\|null WWW_ROOT . 'dist' Absolute filesystem path to the build directory (where Vite writes outDir).
basePath string '/dist/' Public URL prefix prepended to relative paths from the manifest. A leading / is resolved relative to the application base by HtmlHelper.
fileName string '.vite/php.json' Path to the manifest file, relative to buildPath.

buildPath must match the outDir you configure in Vite. For example, if Vite writes to webroot/dist, set buildPath to WWW_ROOT . 'dist' (the default) or an equivalent absolute path.


Runtime behaviour

The plugin writes a single file — {outDir}/.vite/php.json — whose mode field drives the helper's behaviour.

Development

Start the Vite dev server normally:

On server start the plugin writes:

js() emits a <script type="module"> pointing at the dev server, preceded by @vite/client (deduplicated across all calls). css() emits a <script type="module"> for CSS entries — Vite serves CSS files as ESM modules with HMR. When the dev server exits the file is removed.

Production

Build with:

The plugin writes:

js() emits <link rel="modulepreload"> for each import chunk (ESM) followed by <script type="module">, or a classic <script> for IIFE entries. css() emits <link rel="stylesheet"> for each CSS file.

No manifest

When the file is absent (not built, dev server not running) both js() and css() return an empty string. In debug mode an unknown mode value throws a RuntimeException.


All versions of vite-cakephp with dependencies

PHP Build Version
Package Version
Requires php Version >=8.3
ext-json Version *
cakephp/cakephp Version ^4.5 || ^5.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package chialab/vite-cakephp contains the following files

Loading the files please wait ...