Composer and Yii

I use composer as a dependency manager, and since I need to develop using the Yii Framework, I added it to my composer.json file, so it looks like this:

//other properties... "require": { //other dependencies... "yiisoft/yii": "dev-master" } 

Composer.json is fine, Yii is loaded correctly, but there is a function that I think the composer skips. My yii directory is now full of garbage, demo folders, bla bla build files that I really don't need. Is there a way to tell the composer to save only some directory and throw away the rest?

+6
source share
2 answers

We work with the composer differently. With a composer, our application only cares about its code. In fact, if you are kork using git, you have to add the yii folder to .gitignore couse - this is not your application folder. This is the symfony path.

What about Yii !? First of all, I suggest you start yii projects with:

 $ composer create-project yiisoft/yii path/to/your/project 

This is the way Yii works with yii and the composer. After that, when you complete the yii download, the composer asks you if you want to store the yii git files or not. You can simply say no and manually delete these files manually. You can also try fork yiisoft / yii and improve this behavior so that this file deletion happens automatically.

+3
source

I had the same problem, so I finished repackaging Yii so that it only contained the framework folder. It reduces the packet by ~ 10 MB. Here's a link to the github repository .

Just add the following to your composer.json file.

 { "require": { "square1-io/yii-framework": "1.1.14" } } 

Then run:

 $ composer install 

I posted a blog post about this: http://blog.square1.io/post/60830077608/yii-1-1-14-via-composer

+2
source

Source: https://habr.com/ru/post/949441/


All Articles