Leaf PHP

Vite
in package

Table of Contents

Properties

$entryPoints  : array<string|int, mixed>
The configured entry points.
$integrityKey  : string|false
The key to check for integrity hashes within the manifest.
$manifestFilename  : string
The name of the manifest file.
$manifests  : array<string|int, mixed>
The cached manifest files.
$nonce  : string|null
The Content Security Policy nonce to apply to all generated tags.
$paths  : array<string|int, mixed>
The configured paths
$preloadedAssets  : array<string|int, mixed>
The preloaded assets.
$preloadTagAttributesResolvers  : array<string|int, mixed>
The preload tag attributes resolvers.
$scriptTagAttributesResolvers  : array<string|int, mixed>
The script tag attributes resolvers.
$styleTagAttributesResolvers  : array<string|int, mixed>
The style tag attributes resolvers.

Methods

asset()  : string
Get the URL for an asset.
build()  : HtmlString
Generate Vite tags for an entrypoint.
config()  : mixed
Config for vite paths
cspNonce()  : string|null
Get the Content Security Policy nonce applied to all generated tags.
hotFile()  : string
Get the Vite "hot" file path.
isRunningHot()  : bool
Determine if the HMR server is running.
manifestHash()  : string|null
Get a unique hash representing the current manifest, or null if there is no manifest.
preloadedAssets()  : array<string|int, mixed>
Get the preloaded assets.
reactRefresh()  : HtmlString|void
Generate React refresh runtime script.
useCspNonce()  : string
Generate or set a Content Security Policy nonce to apply to all generated tags.
useIntegrityKey()  : mixed
Use the given key to detect integrity hashes in the manifest.
useManifestFilename()  : mixed
Set the filename for the manifest file.
usePreloadTagAttributes()  : mixed
Use the given callback to resolve attributes for preload tags.
useScriptTagAttributes()  : mixed
Use the given callback to resolve attributes for script tags.
useStyleTagAttributes()  : mixed
Use the given callback to resolve attributes for style tags.
withEntryPoints()  : mixed
Set the Vite entry points.
assetPath()  : string
Generate an asset path for the application.
chunk()  : array<string|int, mixed>
Get the chunk for the given entry point / asset.
hotAsset()  : string
Get the path to a given asset when running in HMR mode.
isCssPath()  : bool
Determine whether the given path is a CSS file.
makePreloadTagForChunk()  : string
Make a preload tag for the given chunk.
makeScriptTagWithAttributes()  : string
Generate a script tag with attributes for the given URL.
makeStylesheetTagWithAttributes()  : string
Generate a link tag with attributes for the given URL.
makeTag()  : string
Generate an appropriate tag for the given URL in HMR mode.
makeTagForChunk()  : string
Make tag for the given chunk.
manifest()  : array<string|int, mixed>
Get the the manifest file for the given build directory.
manifestPath()  : string
Get the path to the manifest file for the given build directory.
parseAttributes()  : array<string|int, mixed>
Parse the attributes into key="value" strings.
resolvePreloadTagAttributes()  : array<string|int, mixed>|false
Resolve the attributes for the chunks generated preload tag.
resolveScriptTagAttributes()  : array<string|int, mixed>
Resolve the attributes for the chunks generated script tag.
resolveStylesheetTagAttributes()  : array<string|int, mixed>
Resolve the attributes for the chunks generated stylesheet tag.

Properties

$entryPoints

The configured entry points.

protected static array<string|int, mixed> $entryPoints = []

$integrityKey

The key to check for integrity hashes within the manifest.

protected static string|false $integrityKey = 'integrity'

$manifestFilename

The name of the manifest file.

protected static string $manifestFilename = 'manifest.json'

$manifests

The cached manifest files.

protected static array<string|int, mixed> $manifests = []

$nonce

The Content Security Policy nonce to apply to all generated tags.

protected static string|null $nonce

$paths

The configured paths

protected static array<string|int, mixed> $paths = ['hotFile' => '/hot', 'build' => '/build', 'assets' => '/assets']

$preloadedAssets

The preloaded assets.

protected static array<string|int, mixed> $preloadedAssets = []

$preloadTagAttributesResolvers

The preload tag attributes resolvers.

protected static array<string|int, mixed> $preloadTagAttributesResolvers = []

$scriptTagAttributesResolvers

The script tag attributes resolvers.

protected static array<string|int, mixed> $scriptTagAttributesResolvers = []

$styleTagAttributesResolvers

The style tag attributes resolvers.

protected static array<string|int, mixed> $styleTagAttributesResolvers = []

Methods

asset()

Get the URL for an asset.

public static asset(string $asset[, string|null $buildDirectory = null ]) : string
Parameters
$asset : string
$buildDirectory : string|null = null
Return values
string

build()

Generate Vite tags for an entrypoint.

public static build(string|array<string|int, string> $entrypoints[, string|null $buildDirectory = null ]) : HtmlString
Parameters
$entrypoints : string|array<string|int, string>
$buildDirectory : string|null = null
Tags
throws
Exception
Return values
HtmlString

config()

Config for vite paths

public static config(array<string|int, mixed>|string $config[, mixed $value = null ]) : mixed
Parameters
$config : array<string|int, mixed>|string

The config array or the config key

$value : mixed = null

The config value if $config is a string

cspNonce()

Get the Content Security Policy nonce applied to all generated tags.

public static cspNonce() : string|null
Return values
string|null

hotFile()

Get the Vite "hot" file path.

public static hotFile() : string
Return values
string

isRunningHot()

Determine if the HMR server is running.

public static isRunningHot() : bool
Return values
bool

manifestHash()

Get a unique hash representing the current manifest, or null if there is no manifest.

public static manifestHash([string|null $buildDirectory = null ]) : string|null
Parameters
$buildDirectory : string|null = null
Return values
string|null

preloadedAssets()

Get the preloaded assets.

public static preloadedAssets() : array<string|int, mixed>
Return values
array<string|int, mixed>

reactRefresh()

Generate React refresh runtime script.

public static reactRefresh() : HtmlString|void
Return values
HtmlString|void

useCspNonce()

Generate or set a Content Security Policy nonce to apply to all generated tags.

public static useCspNonce([string|null $nonce = null ]) : string
Parameters
$nonce : string|null = null
Return values
string

useIntegrityKey()

Use the given key to detect integrity hashes in the manifest.

public static useIntegrityKey(string|false $key) : mixed
Parameters
$key : string|false

useManifestFilename()

Set the filename for the manifest file.

public static useManifestFilename(string $filename) : mixed
Parameters
$filename : string

usePreloadTagAttributes()

Use the given callback to resolve attributes for preload tags.

public static usePreloadTagAttributes( Warning: Array to string conversion in phar:///Users/mychidarko/api/vendor/bin/phpdoc/src/phpDocumentor/Transformer/Writer/Twig/LinkRenderer/CallableAdapter.php on line 64 Warning: Array to string conversion in phar:///Users/mychidarko/api/vendor/bin/phpdoc/src/phpDocumentor/Transformer/Writer/Twig/LinkRenderer/CallableAdapter.php on line 64 Warning: Array to string conversion in phar:///Users/mychidarko/api/vendor/bin/phpdoc/src/phpDocumentor/Transformer/Writer/Twig/LinkRenderer/CallableAdapter.php on line 78 callable(string, string, Array, Array): Array|array<string|int, mixed>|false $attributes) : mixed
Parameters
$attributes : Warning: Array to string conversion in phar:///Users/mychidarko/api/vendor/bin/phpdoc/src/phpDocumentor/Transformer/Writer/Twig/LinkRenderer/CallableAdapter.php on line 64 Warning: Array to string conversion in phar:///Users/mychidarko/api/vendor/bin/phpdoc/src/phpDocumentor/Transformer/Writer/Twig/LinkRenderer/CallableAdapter.php on line 64 Warning: Array to string conversion in phar:///Users/mychidarko/api/vendor/bin/phpdoc/src/phpDocumentor/Transformer/Writer/Twig/LinkRenderer/CallableAdapter.php on line 78 callable(string, string, Array, Array): Array|array<string|int, mixed>|false

useScriptTagAttributes()

Use the given callback to resolve attributes for script tags.

public static useScriptTagAttributes( Warning: Array to string conversion in phar:///Users/mychidarko/api/vendor/bin/phpdoc/src/phpDocumentor/Transformer/Writer/Twig/LinkRenderer/CallableAdapter.php on line 64 Warning: Array to string conversion in phar:///Users/mychidarko/api/vendor/bin/phpdoc/src/phpDocumentor/Transformer/Writer/Twig/LinkRenderer/CallableAdapter.php on line 64 callable(string, string, Array, Array): array<string|int, mixed>|array<string|int, mixed> $attributes) : mixed
Parameters
$attributes : Warning: Array to string conversion in phar:///Users/mychidarko/api/vendor/bin/phpdoc/src/phpDocumentor/Transformer/Writer/Twig/LinkRenderer/CallableAdapter.php on line 64 Warning: Array to string conversion in phar:///Users/mychidarko/api/vendor/bin/phpdoc/src/phpDocumentor/Transformer/Writer/Twig/LinkRenderer/CallableAdapter.php on line 64 callable(string, string, Array, Array): array<string|int, mixed>|array<string|int, mixed>

useStyleTagAttributes()

Use the given callback to resolve attributes for style tags.

public static useStyleTagAttributes( Warning: Array to string conversion in phar:///Users/mychidarko/api/vendor/bin/phpdoc/src/phpDocumentor/Transformer/Writer/Twig/LinkRenderer/CallableAdapter.php on line 64 Warning: Array to string conversion in phar:///Users/mychidarko/api/vendor/bin/phpdoc/src/phpDocumentor/Transformer/Writer/Twig/LinkRenderer/CallableAdapter.php on line 64 callable(string, string, Array, Array): array<string|int, mixed>|array<string|int, mixed> $attributes) : mixed
Parameters
$attributes : Warning: Array to string conversion in phar:///Users/mychidarko/api/vendor/bin/phpdoc/src/phpDocumentor/Transformer/Writer/Twig/LinkRenderer/CallableAdapter.php on line 64 Warning: Array to string conversion in phar:///Users/mychidarko/api/vendor/bin/phpdoc/src/phpDocumentor/Transformer/Writer/Twig/LinkRenderer/CallableAdapter.php on line 64 callable(string, string, Array, Array): array<string|int, mixed>|array<string|int, mixed>

withEntryPoints()

Set the Vite entry points.

public static withEntryPoints(array<string|int, mixed> $entryPoints) : mixed
Parameters
$entryPoints : array<string|int, mixed>

assetPath()

Generate an asset path for the application.

protected static assetPath(string $path[, bool|null $secure = null ]) : string
Parameters
$path : string
$secure : bool|null = null
Return values
string

chunk()

Get the chunk for the given entry point / asset.

protected static chunk(array<string|int, mixed> $manifest, string $file) : array<string|int, mixed>
Parameters
$manifest : array<string|int, mixed>
$file : string
Tags
throws
Exception
Return values
array<string|int, mixed>

hotAsset()

Get the path to a given asset when running in HMR mode.

protected static hotAsset(mixed $asset) : string
Parameters
$asset : mixed
Return values
string

isCssPath()

Determine whether the given path is a CSS file.

protected static isCssPath(string $path) : bool
Parameters
$path : string
Return values
bool

makePreloadTagForChunk()

Make a preload tag for the given chunk.

protected static makePreloadTagForChunk(string $src, string $url, array<string|int, mixed> $chunk, array<string|int, mixed> $manifest) : string
Parameters
$src : string
$url : string
$chunk : array<string|int, mixed>
$manifest : array<string|int, mixed>
Return values
string

makeScriptTagWithAttributes()

Generate a script tag with attributes for the given URL.

protected static makeScriptTagWithAttributes(string $url, array<string|int, mixed> $attributes) : string
Parameters
$url : string
$attributes : array<string|int, mixed>
Return values
string

makeStylesheetTagWithAttributes()

Generate a link tag with attributes for the given URL.

protected static makeStylesheetTagWithAttributes(string $url, array<string|int, mixed> $attributes) : string
Parameters
$url : string
$attributes : array<string|int, mixed>
Return values
string

makeTag()

Generate an appropriate tag for the given URL in HMR mode.

protected static makeTag(string $url) : string

Will be removed in a future Laravel version.

Parameters
$url : string
Return values
string

makeTagForChunk()

Make tag for the given chunk.

protected static makeTagForChunk(string $src, string $url, array<string|int, mixed>|null $chunk, array<string|int, mixed>|null $manifest) : string
Parameters
$src : string
$url : string
$chunk : array<string|int, mixed>|null
$manifest : array<string|int, mixed>|null
Return values
string

manifest()

Get the the manifest file for the given build directory.

protected static manifest(string $buildDirectory) : array<string|int, mixed>
Parameters
$buildDirectory : string
Tags
throws
Exception
Return values
array<string|int, mixed>

manifestPath()

Get the path to the manifest file for the given build directory.

protected static manifestPath(string $buildDirectory) : string
Parameters
$buildDirectory : string
Return values
string

parseAttributes()

Parse the attributes into key="value" strings.

protected static parseAttributes(array<string|int, mixed> $attributes) : array<string|int, mixed>
Parameters
$attributes : array<string|int, mixed>
Return values
array<string|int, mixed>

resolvePreloadTagAttributes()

Resolve the attributes for the chunks generated preload tag.

protected static resolvePreloadTagAttributes(string $src, string $url, array<string|int, mixed> $chunk, array<string|int, mixed> $manifest) : array<string|int, mixed>|false
Parameters
$src : string
$url : string
$chunk : array<string|int, mixed>
$manifest : array<string|int, mixed>
Return values
array<string|int, mixed>|false

resolveScriptTagAttributes()

Resolve the attributes for the chunks generated script tag.

protected static resolveScriptTagAttributes(string $src, string $url, array<string|int, mixed>|null $chunk, array<string|int, mixed>|null $manifest) : array<string|int, mixed>
Parameters
$src : string
$url : string
$chunk : array<string|int, mixed>|null
$manifest : array<string|int, mixed>|null
Return values
array<string|int, mixed>

resolveStylesheetTagAttributes()

Resolve the attributes for the chunks generated stylesheet tag.

protected static resolveStylesheetTagAttributes(string $src, string $url, array<string|int, mixed>|null $chunk, array<string|int, mixed>|null $manifest) : array<string|int, mixed>
Parameters
$src : string
$url : string
$chunk : array<string|int, mixed>|null
$manifest : array<string|int, mixed>|null
Return values
array<string|int, mixed>

        
On this page

Search results