PHPackages                             malyusha/laravel-webpack-assets - 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. malyusha/laravel-webpack-assets

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

malyusha/laravel-webpack-assets
===============================

Package to use WebpackManifestPlugin in laravel

v3.0.1(7y ago)64.9k31MITPHPPHP &gt;=7.0

Since Apr 27Pushed 7y ago1 watchersCompare

[ Source](https://github.com/malyusha/laravel-webpack-assets)[ Packagist](https://packagist.org/packages/malyusha/laravel-webpack-assets)[ RSS](/packages/malyusha-laravel-webpack-assets/feed)WikiDiscussions master Synced 2w ago

READMEChangelogDependencies (4)Versions (14)Used By (1)

 [![](https://camo.githubusercontent.com/a84572ae82a33587063f573e647a87bf647da0cf176ab62b35946736ebaaa49a/68747470733a2f2f7472617669732d63692e6f72672f6d616c79757368612f6c61726176656c2d7765627061636b2d6173736574732e7376673f6272616e63683d6d6173746572)](https://camo.githubusercontent.com/a84572ae82a33587063f573e647a87bf647da0cf176ab62b35946736ebaaa49a/68747470733a2f2f7472617669732d63692e6f72672f6d616c79757368612f6c61726176656c2d7765627061636b2d6173736574732e7376673f6272616e63683d6d6173746572)

Laravel Webpack Assets
======================

[](#laravel-webpack-assets)

Package that allows you to include assets from json file, generated by [Webpack Manifest Plugin](https://github.com/danethurber/webpack-manifest-plugin)

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

[](#installation)

Require the latest version of package using [Composer](https://getcomposer.org/)

`$ composer require malyusha/laravel-webpack-assets`

If you are using version of laravel &lt; 5.5, you need to add service provider into your `config/app.php`file in `providers` section:

- `\Malyusha\WebpackAssets\WebpackAssetsServiceProvider::class`

You can add the WebpackAssets facade in `facades` section:

- `'WebpackAssets' => \Malyusha\WebpackAssets\Facade::class`

Configuration
-------------

[](#configuration)

To change package configuration you need to publish configuration file:

`$ php artisan vendor:publish --tag=config`

This will publish `assets_manifest.php` file inside your `config` directory. Configuration file has a few options:

- `file` - path to manifest.json file, relative to `disk` path. See `disk` option;
- `fail_on_load` - whether to fail on load assets file. If true - exception will be thrown;
- `disk` - where your `manifest.json` and all assets file are located. See laravel `config/filesystems.php -> disks`.

Usage
-----

[](#usage)

Package provides helper functions to include script and style HTML elements inside blade templates:

- `webpack_script($script)` - will generate ``;
- `webpack_style($script`- will do the same as `webpack_script` but for style;
- `webpack($chunkName = null)` - will return instance of `Asset` class if no arguments provided, otherwise returns asset url with host.

Examples
--------

[](#examples)

Let's imagine, that you have generated `manifest.json` file with such content:

```
{
  "app.js": "/assets/1b53147322421b069bf1.js",
  "auth.background.png": "/assets/e60cc0de08eee2256222218425eaa943.png",
  "auth.login.css": "/assets/css/20a7e7e51e1f142b2b1f.css",
  "auth.login.js": "/assets/20a7e7e51e1f142b2b1f.js",
  "auth.password.forgot.css": "/assets/css/280c079c4407fbd0fdca.css",
  "auth.password.forgot.js": "/assets/280c079c4407fbd0fdca.js"
}
```

### Retrieving paths

[](#retrieving-paths)

```
$webpackAssets = webpack();
// Full urls with hostname of filesystem. E.g. if disk driver is set to `public`, and `url` option
// is env('APP_URL').'/storage'
echo $webpackAssets->url('app.js'); // Output - http://host.dev/storage/assets/1b53147322421b069bf1.js
echo $webpackAssets->url('app.css'); // Output - http://host.dev/storage/assets/css/20a7e7e51e1f142b2b1f.css

// Absolute path for given filesystem. E.g. if disk driver is set to `public` and `root` parameter set to
// storage_path('app/public')
echo $webpackAssets->path('app.js'); // Output - /{project_dir}/storage/app/public/assets/1b53147322421b069bf1.js

// Relative paths, as they're presented inside json file
echo $webpackAssets->chunkPath('app.js'); // Output - /assets/1b53147322421b069bf1.js
```

### Using in blade templates

[](#using-in-blade-templates)

Whenever you want to output your asset simply write:

```
{!! webpack_script('app.js') !!}

// or

{!! webpack()->image('background.png', 'Background') !!}
// Output:
```

### Raw file contents

[](#raw-file-contents)

When you need to add inline file content, such as css or js wrapped with `style` or `script` tags you can now use helper functions for that: `webpack_raw_style` and `webpack_raw_script`, or if in object - `webpack()->rawStyle()` and `webpack()->rawScript()`.

```
{!! webpack_raw_style('css/main.css') !!}

{{-- Or --}}

{!! webpack()->rawStyle('css/main.css') !!}

{{--Output--}}
...content of main.css file...
```

###  Health Score

34

—

LowBetter than 75% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity25

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity65

Established project with proven stability

 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.

###  Release Activity

Cadence

Every ~66 days

Recently: every ~10 days

Total

12

Last Release

2621d ago

Major Versions

1.0.7 → 2.0.x-dev2019-03-15

v2.0.1 → v3.0.02019-04-27

### Community

Maintainers

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

---

Top Contributors

[![malyusha](https://avatars.githubusercontent.com/u/8385110?v=4)](https://github.com/malyusha "malyusha (3 commits)")

---

Tags

laravelassetswebpackmixlaravel assetslaravel-webpackwebpack manifest plugin laravel

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/malyusha-laravel-webpack-assets/health.svg)

```
[![Health](https://phpackages.com/badges/malyusha-laravel-webpack-assets/health.svg)](https://phpackages.com/packages/malyusha-laravel-webpack-assets)
```

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3345.1M337](/packages/psalm-plugin-laravel)[laravel/mcp

Rapidly build MCP servers for your Laravel applications.

77018.2M124](/packages/laravel-mcp)[laravel/surveyor

Static analysis tool for Laravel applications.

8690.3k12](/packages/laravel-surveyor)[api-platform/laravel

API Platform support for Laravel

59156.3k11](/packages/api-platform-laravel)

PHPackages © 2026

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