Yii Framework Forum: Minimal working framework package? - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Minimal working framework package? Rate Topic: -----

#1 User is offline   phantomlord 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 21
  • Joined: 15-October 17

Posted 23 October 2017 - 06:58 AM

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 ::)
0

#2 User is offline   jimgwhit2 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 49
  • Joined: 27-September 17
  • Location:U.S.A.

Posted 23 October 2017 - 03:55 PM

Quote

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


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/n...mework/tree/2.2 or https://www.slimframework.com/ or https://github.com/panique/mini3

3. Write your own custom framework
0

#3 User is offline   samdark 

  • Having fun
  • Yii
  • Group: Yii Dev Team
  • Posts: 5,184
  • Joined: 17-January 09
  • Location:Russia

Posted 23 October 2017 - 04:29 PM

You can remove some of dependencies from your composer.json
Yii 2.0 Development Cookbook

Enjoying Yii? Star us at github

Support me so I can work more on Yii: https://www.patreon.com/samdark
0

#4 User is offline   jacmoe 

  • Elite Member
  • Yii
  • Group: Moderators
  • Posts: 3,694
  • Joined: 10-October 10
  • Location:Denmark

Posted 23 October 2017 - 04:43 PM

View Postphantomlord, on 23 October 2017 - 06:58 AM, said:

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


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.
"Less noise - more signal"
0

#5 User is offline   jacmoe 

  • Elite Member
  • Yii
  • Group: Moderators
  • Posts: 3,694
  • Joined: 10-October 10
  • Location:Denmark

Posted 23 October 2017 - 04:45 PM

Many packages (folders) are used for devopment, so try and pass '--no-dev' to Composer when you create your Yii2 Basic project.
"Less noise - more signal"
0

#6 User is offline   phantomlord 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 21
  • Joined: 15-October 17

Posted 24 October 2017 - 03:06 AM

View Postjimgwhit2, on 23 October 2017 - 03:55 PM, said:

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/n...mework/tree/2.2 or https://www.slimframework.com/ or https://github.com/panique/mini33. Write your own custom framework


View Postjacmoe, on 23 October 2017 - 04:43 PM, said:

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 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.
0

#7 User is offline   jacmoe 

  • Elite Member
  • Yii
  • Group: Moderators
  • Posts: 3,694
  • Joined: 10-October 10
  • Location:Denmark

Posted 24 October 2017 - 05:29 AM

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. :)
"Less noise - more signal"
0

#8 User is offline   jacmoe 

  • Elite Member
  • Yii
  • Group: Moderators
  • Posts: 3,694
  • Joined: 10-October 10
  • Location:Denmark

Posted 24 October 2017 - 08:12 AM

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

https://github.com/cebe/assetfree-yii2

instead of yii2.
"Less noise - more signal"
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users