Minimal working framework package?

Hello. I wonder how can I minimize the framework bundle. The main question is about vendor directory. Even basic app template contains over 20 vendors folders there. Are they all really necessary for the framework to work?

When I try to delete some folders from there I get an error from composer autoload script where all the vendors are listed.

May I just have yii-soft folder without any other "vendors"? (or at least minimize their number).

UPD. I removed the call to composer autoload at all :) Now it seems that only bower is necessary. Lets see how it is going to work. I will add folders whenever I get errors that something is missing ::)

Three things you need to choose from:

  1. Learn alot more about modern frameworks and the purpose of the vendor folder.

  2. Use a smaller framework like https://github.com/nova-framework/framework/tree/2.2 or https://www.slimframework.com/ or https://github.com/panique/mini3

  3. Write your own custom framework

You can remove some of dependencies from your composer.json

Do you think that the contents of the ‘vendor’ folder are all just for fun and giggles?

20 folders is pretty minimal these days, to be honest.

Compared to Node.js at least, or Laravel or Symphony.

Many packages (folders) are used for devopment, so try and pass ‘–no-dev’ to Composer when you create your Yii2 Basic project.

Many thanks for your replies. I don’t want another framework and I also don’t think that any of the components are for fun. I simply want to remove unused extras, and I don’t think that this is bad practice.

No, it’s good practice to question things :)

It depends on what you need. What kind of packages do you need?

This is the composer.json for the basic application:


	"require": {

    	"php": ">=5.4.0",

    	"yiisoft/yii2": "~2.0.5",

    	"yiisoft/yii2-bootstrap": "~2.0.0",

    	"yiisoft/yii2-swiftmailer": "~2.0.0"

	},

	"require-dev": {

    	"yiisoft/yii2-debug": "~2.0.0",

    	"yiisoft/yii2-gii": "~2.0.0",

    	"yiisoft/yii2-faker": "~2.0.0",


    	"codeception/codeception": "^2.2.3",

    	"codeception/verify": "~0.3.1",

    	"codeception/specify": "~0.4.3"

	},



Do you need anything in the ‘dev’ section?

If you don’t remove it.

Also, if you are not planning on using Bootstrap, remove that one too.

Likewise for the mailer.

Try just having Yii2 as a dependency:


	"require": {

    	"php": ">=5.4.0",

    	"yiisoft/yii2": "~2.0.5"

	},



To test this, delete the ‘vendor’ directory and perform a ‘composer install’.

You should get a feel for the ‘vendor’ directory fairly quickly. :)

If you feel that you don’t need even what yii2 itself requires, you can shave off the assets (bower-asset) by using

instead of yii2.