LaravelPackages.net
Acme Inc.
Toggle sidebar
mosaxiv/cakephp-mix

Helper to use laravel-mix with CakePHP3

4.002
5
v0.0.3
About mosaxiv/cakephp-mix

mosaxiv/cakephp-mix is a Laravel package for helper to use laravel-mix with cakephp3. It currently has 5 GitHub stars and 4.002 downloads on Packagist (latest version v0.0.3). Install it with composer require mosaxiv/cakephp-mix. Discover more Laravel packages by mosaxiv or browse all Laravel packages to compare alternatives.

Last updated

Mix plugin for CakePHP3

Helper to use laravel-mix with CakePHP3.

This is similar to the mix() function of Laravel.

MIT License

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="https://raw.githubusercontent.com/mosaxiv/cakephp-mix/refs/heads/main/js/app.js"></script>
$this->Mix->htmlScript('app');

load css

// /css/app.css
$this->Mix->css('app');

// <script src="https://raw.githubusercontent.com/mosaxiv/cakephp-mix/refs/heads/main/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
Comments