mosaxiv / cakephp-mix
Helper to use laravel-mix with CakePHP3
Installs: 3 487
Dependents: 0
Suggesters: 0
Security: 0
Stars: 5
Watchers: 1
Forks: 2
Open Issues: 0
Type:cakephp-plugin
Requires
- cakephp/cakephp: ~3.4
Requires (Dev)
- cakephp/cakephp-codesniffer: ^3.0
- phpunit/phpunit: ^5.7|^6.0
This package is auto-updated.
Last update: 2025-04-15 06:57:49 UTC
README
Helper to use laravel-mix with CakePHP3.
This is similar to the mix() function of Laravel.
Requirements
- PHP 7.0+
- CakePHP 3.4+
Installation
You can install this plugin into your CakePHP application using composer.
The recommended way to install composer packages is:
composer require mosaxiv/cakephp-mix
Usage
AppView Setup
load Helper
// src/View/AppView.php namespace App\View; use Cake\View\View; class AppView extends View { public function initialize() { $this->loadHelper('CakeMix.Mix'); } }
Helper Usage
load script
// /js/app.js $this->Mix->script('app'); // <script src="/js/app.js"></script> $this->Mix->htmlScript('app');
load css
// /css/app.css $this->Mix->css('app'); // <script src="/css/app.css"></script> $this->Mix->htmlCss('app');
TIPS
By using create-laravel-mix you can build environment fast.
Exsample:
npx create-laravel-mix react --public-dir webroot