PHPackages                             ishanvyas22/asset-mix - 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. ishanvyas22/asset-mix

ActiveCakephp-plugin[Utility &amp; Helpers](/categories/utility)

ishanvyas22/asset-mix
=====================

Asset Mix plugin for CakePHP

2.0.0(2y ago)3375.4k↓15.8%12[1 issues](https://github.com/ishanvyas22/asset-mix/issues)2MITPHP

Since Oct 15Pushed 1y ago2 watchersCompare

[ Source](https://github.com/ishanvyas22/asset-mix)[ Packagist](https://packagist.org/packages/ishanvyas22/asset-mix)[ Docs](https://github.com/ishanvyas22/asset-mix)[ Patreon](https://www.patreon.com/ishanvyas)[ RSS](/packages/ishanvyas22-asset-mix/feed)WikiDiscussions cake5 Synced 1mo ago

READMEChangelog (10)Dependencies (4)Versions (33)Used By (2)

AssetMix plugin for CakePHP
===========================

[](#assetmix-plugin-for-cakephp)

[![Latest Stable Version](https://camo.githubusercontent.com/9b7eb4a9e3d9e8828831ea8c4f755c491db9ca738b69672df565b49dbbc9ea0b/68747470733a2f2f706f7365722e707567782e6f72672f697368616e7679617332322f61737365742d6d69782f762f737461626c65)](https://packagist.org/packages/ishanvyas22/asset-mix)[![Total Downloads](https://camo.githubusercontent.com/a9367a2bff56029675e95e5216150d242f34338b18fb402754a533f13b497a50/68747470733a2f2f706f7365722e707567782e6f72672f697368616e7679617332322f61737365742d6d69782f646f776e6c6f616473)](https://packagist.org/packages/ishanvyas22/asset-mix)[![License](https://camo.githubusercontent.com/d1ff6e50e3fd980fe4e91333f336545c56d8cf53f5c5bfa9076df1d9f6a0bd98/68747470733a2f2f706f7365722e707567782e6f72672f697368616e7679617332322f61737365742d6d69782f6c6963656e7365)](https://packagist.org/packages/ishanvyas22/asset-mix)[![CakePHP](https://camo.githubusercontent.com/b260202332076ec50541827fdd0716d8582414fbef9b24d81844f01479da7d48/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f63616b657068702d253545352e302e302d7265643f6c6f676f3d63616b65706870)](https://book.cakephp.org/5/en/index.html)[![Tests](https://github.com/ishanvyas22/asset-mix/workflows/Run%20tests/badge.svg?branch=master)](https://github.com/ishanvyas22/asset-mix/workflows/Run%20tests/badge.svg?branch=master)[![PHPStan Check](https://github.com/ishanvyas22/asset-mix/workflows/Run%20PHPStan/badge.svg?branch=master)](https://github.com/ishanvyas22/asset-mix/workflows/Run%20PHPStan/badge.svg?branch=master)[![Coding Style Check](https://github.com/ishanvyas22/asset-mix/workflows/Check%20Coding%20Style/badge.svg?branch=master)](https://github.com/ishanvyas22/asset-mix/workflows/Check%20Coding%20Style/badge.svg?branch=master)

Provides integration with your [CakePHP application](https://cakephp.org/) &amp; [Laravel Mix](https://laravel-mix.com).

This branch works with **CakePHP 5.0+**, see [version map](#version-map) for more details.

❤️ Support The Development
--------------------------

[](#️--support-the-development)

**Do you like this project? Support it by donating:**

[ ![Buy Me A Coffee](https://camo.githubusercontent.com/b32d80c4bde7464703f7dcbb8dd24902a7b2de6b0f52a872563f87293d4eb87a/68747470733a2f2f7777772e6275796d6561636f666665652e636f6d2f6173736574732f696d672f637573746f6d5f696d616765732f707572706c655f696d672e706e67)](https://www.buymeacoffee.com/ishanvyas)[ ![](https://camo.githubusercontent.com/56529e692201ddc4f9a8911f23e3d9cc7e9e7536b2c99114d4971f185eaaa6be/68747470733a2f2f63352e70617472656f6e2e636f6d2f65787465726e616c2f6c6f676f2f6265636f6d655f615f706174726f6e5f627574746f6e4032782e706e67)](https://www.patreon.com/ishanvyas)**or** [Paypal me](https://paypal.me/IshanVyas?locale.x=en_GB)

**or** [![Contact me on Codementor](https://camo.githubusercontent.com/8410a61f8de81462effe5c508f686a5908db7d82533f91afe870d9cd023fa1fc/68747470733a2f2f7777772e636f64656d656e746f722e696f2f6d2d6261646765732f6973767961732f6765742d68656c702e737667)](https://www.codementor.io/@isvyas?refer=badge)

### Follow me

[](#follow-me)

- [GitHub](https://github.com/ishanvyas22)
- [LinkedIn](https://www.linkedin.com/in/ishan-vyas-314111112)
- [Twitter](https://twitter.com/ishanvyas22)

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

[](#installation)

1. Install the AssetMix plugin with composer:

    Via [composer](https://packagist.org/packages/ishanvyas22/asset-mix):

    ```
    composer require ishanvyas22/asset-mix
    ```
2. Load plugin using below command:

    ```
    bin/cake plugin load AssetMix
    ```
3. [Generate basic Javascript, CSS &amp; Sass scaffolding](#generate-command):

    ```
    bin/cake asset_mix generate
    ```

    **Note:** Above command will generate scaffolding for vue, but you can generate [Bootstrap/jQuery](#generate-basic-bootstrapjquery-scaffolding), [React](#generate-react-scaffolding) or [Inertia](#generate-scaffolding-for-inertiajs) scaffolding too.
4. Install frontend dependencies

    - Using [npm](https://www.npmjs.com/):

    ```
    npm install
    ```

    or

    - Using [yarn](https://yarnpkg.com/):

    ```
    yarn install
    ```
5. [Compile your assets](https://laravel-mix.com/docs/4.0/workflow#step-4-compilation)

    - For development:

    ```
    npm run dev
    ```

    - To watch changes:

    ```
    npm run watch
    ```

    - For production:

    ```
    npm run prod
    ```
6. Load `AssetMix` helper from the plugin into your `AppView.php` file:

    ```
    $this->loadHelper('AssetMix.AssetMix');
    ```

Usage
-----

[](#usage)

After compiling your assets(js, css) with laravel mix, it creates a `mix-manifest.json` file into your `webroot` directory which contains information to map the files.

- To generate script tag for compiled javascript file(s):

```
echo $this->AssetMix->script('app');
```

Above code will render:

```

```

As you can see it works same as [HtmlHelper](https://book.cakephp.org/3.0/en/views/helpers/html.html#linking-to-javascript-files). There is not need to provide full path or even file extension.

- To generate style tag for compiled css file(s):

```
echo $this->AssetMix->css('main');
```

Output:

```

```

If [versioning](https://laravel-mix.com/docs/4.0/versioning) is enabled, output will look something like below:

```

```

Generate command
----------------

[](#generate-command)

The generate command is used to generate starter code for your Javascript application to get you started developing your frontend.

Get help:

```
bin/cake asset_mix -h
```

Generate default scaffolding (with vue):

```
bin/cake asset_mix generate
```

Above command will generate:

- `package.json`
- `webpack.mix.js`
- `assets/`
    - `css/`
    - `js/`
    - `sass/`

`assets/` directory is where you will store your js, css files which will compile down into your respective `webroot/` directory.

Custom directory name:

```
bin/cake asset_mix generate --dir=resources
```

You can also use custom directory name instead of default `assets` directory, above command will create `resources` directory where you can put your js, css, etc asset files.

Don't want to use Vue.js? Don't worry this plugin doesn't dictate on which Javascript library you should use. This plugin provides ability to quickly generate scaffolding for Vue as well as Bootstrap, and React.

#### Generate basic Bootstrap/jQuery scaffolding:

[](#generate-basic-bootstrapjquery-scaffolding)

```
bin/cake asset_mix generate bootstrap
```

#### Generate React scaffolding:

[](#generate-react-scaffolding)

```
bin/cake asset_mix generate react
```

#### Generate scaffolding for [Inertia.js](https://inertiajs.com/):

[](#generate-scaffolding-for-inertiajs)

```
# for vue
bin/cake asset_mix generate inertia-vue

# or for react
bin/cake asset_mix generate inertia-react
```

#### Generate React scaffolding inside `resources` directory:

[](#generate-react-scaffolding-inside-resources-directory)

```
bin/cake asset_mix generate react --dir=resources
```

Serving CakePHP out of a Subdirectory
-------------------------------------

[](#serving-cakephp-out-of-a-subdirectory)

Please see [docs/ServingFromSubdirectory](docs/ServingFromSudirectory.md)

Version map
-----------

[](#version-map)

AssetMix versionBranchCakePHP versionPHP minimum version2.xcake5&gt;=5.0.0&gt;=8.11.xcake4&gt;=4.0.0&gt;=7.20.xcake3&gt;=3.5.0&gt;=5.6Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG-2.x.md) for more information about recent changes.

Reference
---------

[](#reference)

To see this plugin into action you can refer to this [project](https://github.com/ishanvyas22/cakephpvue-spa), which will provide more insight.

License
-------

[](#license)

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

###  Health Score

44

—

FairBetter than 92% of packages

Maintenance28

Infrequent updates — may be unmaintained

Popularity42

Moderate usage in the ecosystem

Community25

Small or concentrated contributor base

Maturity69

Established project with proven stability

 Bus Factor1

Top contributor holds 92.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.

###  Release Activity

Cadence

Every ~54 days

Recently: every ~220 days

Total

29

Last Release

888d ago

Major Versions

0.6.2 → 1.1.12020-10-29

0.6.3 → 1.2.02020-11-22

0.6.4 → 1.3.02021-03-20

0.6.5 → 1.5.02023-04-03

1.5.0 → 2.0.02023-12-12

### Community

Maintainers

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

---

Top Contributors

[![ishanvyas22](https://avatars.githubusercontent.com/u/17404636?v=4)](https://github.com/ishanvyas22 "ishanvyas22 (222 commits)")[![ishan-biztech](https://avatars.githubusercontent.com/u/61005017?v=4)](https://github.com/ishan-biztech "ishan-biztech (5 commits)")[![toggenation](https://avatars.githubusercontent.com/u/4483692?v=4)](https://github.com/toggenation "toggenation (2 commits)")[![LordSimal](https://avatars.githubusercontent.com/u/9105243?v=4)](https://github.com/LordSimal "LordSimal (2 commits)")[![markstory](https://avatars.githubusercontent.com/u/24086?v=4)](https://github.com/markstory "markstory (2 commits)")[![hevertonfreitas](https://avatars.githubusercontent.com/u/2679081?v=4)](https://github.com/hevertonfreitas "hevertonfreitas (1 commits)")[![deepsourcebot](https://avatars.githubusercontent.com/u/60907429?v=4)](https://github.com/deepsourcebot "deepsourcebot (1 commits)")[![Andream98](https://avatars.githubusercontent.com/u/52160332?v=4)](https://github.com/Andream98 "Andream98 (1 commits)")[![robertpustulka](https://avatars.githubusercontent.com/u/7437773?v=4)](https://github.com/robertpustulka "robertpustulka (1 commits)")[![amayer-hc](https://avatars.githubusercontent.com/u/63778085?v=4)](https://github.com/amayer-hc "amayer-hc (1 commits)")[![dereuromark](https://avatars.githubusercontent.com/u/39854?v=4)](https://github.com/dereuromark "dereuromark (1 commits)")[![glennforrest](https://avatars.githubusercontent.com/u/12944411?v=4)](https://github.com/glennforrest "glennforrest (1 commits)")

---

Tags

assetscakephpcakephp-pluginjavascriptlaravel-mixminifierreactreactjssaasscaffoldingvuevuejsjavascriptcakephpminifiersasslessassetscakephp-pluginlaravel-mix

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/ishanvyas22-asset-mix/health.svg)

```
[![Health](https://phpackages.com/badges/ishanvyas22-asset-mix/health.svg)](https://phpackages.com/packages/ishanvyas22-asset-mix)
```

###  Alternatives

[markstory/asset_compress

An asset compression plugin for CakePHP. Provides file concatenation and a flexible filter system for preprocessing and minification.

3761.0M11](/packages/markstory-asset-compress)[markstory/mini-asset

An asset compression library. Provides file concatenation and a flexible filter system for preprocessing and minification.

66741.1k3](/packages/markstory-mini-asset)[matthiasmullie/minify

CSS &amp; JavaScript minifier, in PHP. Removes whitespace, strips comments, combines files (incl. @import statements and small assets in CSS files), and optimizes/shortens a few common programming patterns.

2.0k30.5M336](/packages/matthiasmullie-minify)[tedivm/jshrink

Javascript Minifier built in PHP

76037.7M139](/packages/tedivm-jshrink)[scssphp/scssphp

scssphp is a compiler for SCSS written in PHP.

62827.7M220](/packages/scssphp-scssphp)[trentrichardson/cakephp-shrink

Compiles, combines, and minifies javascript, coffee, less, scss, and css

1619.3k](/packages/trentrichardson-cakephp-shrink)

PHPackages © 2026

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