PHPackages                             toar86/laravel-encore - 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. toar86/laravel-encore

ActiveLibrary

toar86/laravel-encore
=====================

Integrate Webpack Encore in Laravel.

0578PHP

Since Sep 20Pushed 2y agoCompare

[ Source](https://github.com/toar86/laravel-encore)[ Packagist](https://packagist.org/packages/toar86/laravel-encore)[ RSS](/packages/toar86-laravel-encore/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Laravel Encore
==============

[](#laravel-encore)

 [ ![Latest version on Packagist](https://camo.githubusercontent.com/46944fa74115ce00c902d9b7b5285472bd992c6b1166ba99e6495160b9e17321/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f746572706f6d6f6a2f6c61726176656c2d656e636f72652e737667) ](https://packagist.org/packages/terpomoj/laravel-encore) [ ![Total Downloads](https://camo.githubusercontent.com/1f28afbcdbbd93f53f69c154e924ed672125d5d4d94c60f299db3b2e9ba25152/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f746572706f6d6f6a2f6c61726176656c2d656e636f72652e737667) ](https://packagist.org/packages/terpomoj/laravel-encore) [ ![Build](https://github.com/terpomoj/laravel-encore/workflows/CI/badge.svg) ](https://github.com/terpomoj/laravel-encore/actions)

This package helps to integrate [Webpack Encore](https://symfony.com/doc/current/frontend/encore) with Laravel.

> This package was originally authored by [@innocenzi](https://github.com/innocenzi). As they claimed to not going to maintain it anymore, I decided to fork it and continue to provide support for it.

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

[](#installation)

You can install the package via composer:

```
composer require toar86/laravel-encore
```

Installing Encore
-----------------

[](#installing-encore)

### Manually

[](#manually)

Remove `laravel-mix` and add `@symfony/webpack-encore`.

```
npm remove laravel-mix
npm install @symfony/webpack-encore --dev
```

Remove your `webpack.mix.js` and create a `webpack.config.js`. Here is an example:

```
const Encore = require('@symfony/webpack-encore');

if (!Encore.isRuntimeEnvironmentConfigured()) {
  Encore.configureRuntimeEnvironment(process.env.NODE_ENV || 'dev');
}

Encore
  .setOutputPath('public/build/')
  .setPublicPath('/build')
  .addEntry('app', './resources/js/app.js')
  .splitEntryChunks()
  .enableSingleRuntimeChunk()
  .enablePostCssLoader()
  .cleanupOutputBeforeBuild()
  .enableSourceMaps(!Encore.isProduction())
  .enableVersioning(Encore.isProduction());

module.exports = Encore.getWebpackConfig();
```

Make sure `resources/js/app.js` exists. Ideally, it should import your CSS as well, but if you don't want to, you can add [`addStyleEntry`](https://symfony.com/doc/current/frontend/encore/simple-example.html#compiling-only-a-css-file) to your Encore configuration.

```
// resources/js/app.js
import '../css/app.css';
```

Make sure you add `public/build/` (or whatever output path you set) to your `.gitignore`.

Last, but not least, you should replace the scripts in your `package.json` with the following:

```
// package.json
{
  "scripts": {
    "dev-server": "encore dev-server",
    "dev": "encore dev",
    "watch": "encore dev --watch",
    "build": "encore production --progress"
  }
}
```

Usage
-----

[](#usage)

In your blade components, use the `@encoreStyles` and `@encoreScripts` directives to include the assets generated by Encore.

```

    Laravel

    @encoreStyles
    @encoreScripts

    Hello.

```

By default, it will look for the `app` entries, but you can change them by passing an entry name in each directive.

```
@encoreStyles('app')
@encoreScripts('admin')
```

If you used [static assets](https://symfony.com/doc/current/frontend/encore/copy-files.html), you can use `Encore::asset('build/path/to/your/asset.png')` to include it. Under the hood, it's just a mapping to the [manifest.json](https://symfony.com/doc/current/frontend/encore/versioning.html).

License
-------

[](#license)

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

###  Health Score

17

—

LowBetter than 6% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity21

Early-stage or recently created project

 Bus Factor1

Top contributor holds 72.5% 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/cc806c43335bd5ee511344a623bb5e3d23b79a1655a9f39d1a47438a454e6f98?d=identicon)[toar1986](/maintainers/toar1986)

---

Top Contributors

[![innocenzi](https://avatars.githubusercontent.com/u/16060559?v=4)](https://github.com/innocenzi "innocenzi (29 commits)")[![binotaliu](https://avatars.githubusercontent.com/u/67255597?v=4)](https://github.com/binotaliu "binotaliu (6 commits)")[![toar86](https://avatars.githubusercontent.com/u/4595521?v=4)](https://github.com/toar86 "toar86 (3 commits)")[![Tofandel](https://avatars.githubusercontent.com/u/6115458?v=4)](https://github.com/Tofandel "Tofandel (2 commits)")

### Embed Badge

![Health badge](/badges/toar86-laravel-encore/health.svg)

```
[![Health](https://phpackages.com/badges/toar86-laravel-encore/health.svg)](https://phpackages.com/packages/toar86-laravel-encore)
```

PHPackages © 2026

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