Do I need to install `fxp/composer-asset-plugin` if I'm not doing front-end development

In this section of the yii2 installation guide there’s the following instructions:

I’ve read about composer-asset-plugin here and seems that it’s used to manage front-end dependencies through composer. As I’m not developing for front-end, do I need to install this plugin anyway?

Are you developing only the console commands?

I mean, what exactly do you mean by "front-end"?

If you are going to develop a web application, you’ll need to install those dependencies even if you are not responsible for writing “front-end” scripts. The framework needs them for a web app.

Yes. We’re going to fix that in 2.1.

Thanks, guys, which part of the framework does need the dependencies in question? I’m only using the framework for the REST interface, and not using any View components.

Please look at these discussions on github.

Thanks. Here is the quote from the last linked discussion:

How do I find out the list of required bower package names?

The following is from @vendor/yiisoft/yii2/composer.json.




    ...

    "require": {

        "php": ">=5.4.0",

        "ext-mbstring": "*",

        "lib-pcre": "*",

        "yiisoft/yii2-composer": "*",

        "ezyang/htmlpurifier": "4.6.*",

        "cebe/markdown": "~1.0.0 | ~1.1.0",

        "bower-asset/jquery": "2.1.*@stable | 1.11.*@stable",

        "bower-asset/jquery.inputmask": "3.1.*",

        "bower-asset/punycode": "1.3.*",

        "bower-asset/yii2-pjax": ">=2.0.1"

    },

    ...



So, probably you can add the following in your @app/composer.json:




    ...

    "provide": {

        "ezyang/htmlpurifier": "4.6.*",

        "cebe/markdown": "~1.0.0 | ~1.1.0",

        "bower-asset/jquery": "2.1.*@stable | 1.11.*@stable",

        "bower-asset/jquery.inputmask": "3.1.*",

        "bower-asset/punycode": "1.3.*",

        "bower-asset/yii2-pjax": ">=2.0.1"

    },

    ...



I guess you may also exclude htmlpurifier and markdown as well as bower-asset/something, since REST api usually won’t need them.

Thanks a lot, I’ll add these to the project’s composer.json and test it.

If you have started with the basic or advanced project template, take additional care to check the “require” section of the project’s composer.json. I think you can delete some of them safely. For instance, “yiisoft/yii2-bootstrap” and “yiisoft/yii2-jui” are not necessary for your purpose, but will require some bower assets as their dependencies.

Thanks a lot, will do that