PHPackages                             motomedialab/laravel-vite-helper - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. motomedialab/laravel-vite-helper

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

motomedialab/laravel-vite-helper
================================

A helper method to generate absolute asset URL's to Vite assets

v1.9.0(2mo ago)29571.0k—6.3%22MITPHPPHP ^8.0CI passing

Since Jul 10Pushed 2mo ago2 watchersCompare

[ Source](https://github.com/motomedialab/laravel-vite-helper)[ Packagist](https://packagist.org/packages/motomedialab/laravel-vite-helper)[ Docs](https://github.com/motomedialab/laravel-vite-helper)[ RSS](/packages/motomedialab-laravel-vite-helper/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (8)Dependencies (8)Versions (17)Used By (2)

Laravel `vite()` helper method
==============================

[](#laravel-vite-helper-method)

[![Latest Version on Packagist](https://camo.githubusercontent.com/e64179038b9db0e6fa9dcdb50450efae99368526a8ef0cea2f2f660e837aca24/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6d6f746f6d656469616c61622f6c61726176656c2d766974652d68656c7065722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/motomedialab/laravel-vite-helper)[![Total Downloads](https://camo.githubusercontent.com/13e130d6f4de14afa56858ddf5d464b1a74b1df4d8769b31be6b20a66325b84d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6d6f746f6d656469616c61622f6c61726176656c2d766974652d68656c7065722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/motomedialab/laravel-vite-helper)[![GitHub Actions](https://github.com/motomedialab/laravel-vite-helper/actions/workflows/main.yml/badge.svg)](https://github.com/motomedialab/laravel-vite-helper/actions/workflows/main.yml/badge.svg)

A super simple Laravel helper to fill the void that Laravel Mix left. Mix had a helper, aptly named `mix()`that would return an absolute URL to the mix resource. With the introduction of Vite (as of Laravel 9.19), there is no equivalent for Vite, at least, until now.

This was originally submitted as a [PR](https://github.com/laravel/framework/pull/43098) to the core Laravel framework, but unfortunately wasn't deemed as a necessary addition.

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require motomedialab/laravel-vite-helper
```

Usage
-----

[](#usage)

The usage for this helper is extremely simple, and directly replaces Laravel's `mix()` helper.

```
// will return the absolute compiled asset path for 'resources/css/app.css'
vite('resources/css/app.css');

// will return the absolute compiled asset path for
// 'resources/css/app.css' with custom build directory 'dist'
vite('resources/css/app.css', 'dist');

// the third argument enforces a relative path to be returned
vite('resources/css/app.css', 'build', true);

// the final argument allows you to force disable hot server mode and always return the manifest path
vite('resources/css/app.css', 'build', true, true);

// you can also use named arguments as below
vite('resources/css/app.css', buildDirectory: 'dist', relative: true, hotServer: true);

// and even supply an array to get an array of paths/URLs
vite(['resources/css/app.css', 'resources/js/app.js']);
```

### Mocking in your own tests

[](#mocking-in-your-own-tests)

Using this helper may cause some tests that directly interact with your web pages to break if you don't have the compiled assets available (e.g. in a CI/CD flow).

To overcome this, there's a `MocksViteHelper` trait that can be used within your tests:

```
class ExampleTest extends TestCase
{
    use MocksViteHelper;

    public function a_request_to_a_view_using_vite_helper()
    {
        $this->withoutViteHelper();

        $response = $this->get('/');

        $response->assertStatus(200);
    }

    public function restore_vite_helper_functionality()
    {
        $this->withViteHelper();

        $response = $this->get('/');

        $response->assertStatus(500);
    }
}
```

### Testing

[](#testing)

```
composer test
```

### Changelog

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

### Security

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Chris Page](https://github.com/motomedialab)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

Laravel Package Boilerplate
---------------------------

[](#laravel-package-boilerplate)

This package was generated using the [Laravel Package Boilerplate](https://laravelpackageboilerplate.com).

###  Health Score

57

—

FairBetter than 98% of packages

Maintenance88

Actively maintained with recent releases

Popularity46

Moderate usage in the ecosystem

Community18

Small or concentrated contributor base

Maturity61

Established project with proven stability

 Bus Factor1

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

Every ~103 days

Recently: every ~192 days

Total

14

Last Release

61d ago

PHP version history (2 changes)v1.0.0PHP ^8.0

v1.3.0PHP ^8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/805ae1048fb81d8f02871f57cc0a34699089da17f7021210e554ffdba4df918a?d=identicon)[chrispage1](/maintainers/chrispage1)

---

Top Contributors

[![chrispage1](https://avatars.githubusercontent.com/u/2487374?v=4)](https://github.com/chrispage1 "chrispage1 (27 commits)")[![laravel-shift](https://avatars.githubusercontent.com/u/15991828?v=4)](https://github.com/laravel-shift "laravel-shift (3 commits)")[![DrAliRagab](https://avatars.githubusercontent.com/u/37520558?v=4)](https://github.com/DrAliRagab "DrAliRagab (1 commits)")[![francoism90](https://avatars.githubusercontent.com/u/5028905?v=4)](https://github.com/francoism90 "francoism90 (1 commits)")

---

Tags

motomedialablaravel-vite-helper

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/motomedialab-laravel-vite-helper/health.svg)

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

###  Alternatives

[wireui/wireui

TallStack components

1.8k1.3M16](/packages/wireui-wireui)[livewire/volt

An elegantly crafted functional API for Laravel Livewire.

4205.3M84](/packages/livewire-volt)[ramonrietdijk/livewire-tables

Dynamic tables for models with Laravel Livewire

21147.4k](/packages/ramonrietdijk-livewire-tables)[motomedialab/simple-laravel-audit

A simple audit helper that integrates directly with Laravel &amp; FilamentPHP

262.7k](/packages/motomedialab-simple-laravel-audit)[motomedialab/laravel-self-healing-urls

Generate self-healing URLs for models

252.7k](/packages/motomedialab-laravel-self-healing-urls)

PHPackages © 2026

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