Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Composer and Yii

I'm using composer as my dependency manager and since I need to develop with 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 ok, Yii downloaded correctly, but there is a feature I think composer misses. My yii directory now is full of "rubbish", demo folders, build files bla bla that I don't really need. There is a way to tell composer to keep only some directory and throw away the others?

like image 802
th3n3rd Avatar asked Jul 15 '13 06:07

th3n3rd


People also ask

What is Yii used for?

Yii is a high-performance, component-based PHP framework for developing large-scale Web applications rapidly. It enables maximum reusability in Web programming and can significantly accelerate your Web application development process. The name Yii (pronounced Yee or [ji:] ) is an acroynym for "Yes It Is!".

What is difference between Yii and Yii2?

Conceptually Yii1 and Yii2 are quite similar, however Yii2 runs on newer PHP versions and utilizes namespaces, traits etc. Yii2 has also support for dependency injection through $container singleton available after initializing the framework.

Is Yii a good framework?

The official website claims that Yii is a fast, secure and efficient PHP framework designed for creating bespoke web applications. Just like Laravel, Yii has an open-source code and was initially intended to eliminate the disadvantages of PRADO framework.

Who created Yii framework?

Uday, Sawant (2013). Instant Building Multi-Page Forms with Yii How-to. Packt Publishing. ISBN 978-1-78216-642-9 .


1 Answers

With composer we work in a different way. With composer our application take care only of its code. In fact, if you kork with git, you must add yii folder to .gitignore couse is not your application folder. This is the symfony way.

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

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

This is the Yii way to work with yii and composer. After that, when you finish to dowload yii, composer ask you if you want to keep or not yii's git files. You can simply say no, and remove manually these files. You can also try to fork yiisoft/yii and improve this behavior so this removing stuffs will happen automatically.

like image 155
sensorario Avatar answered Oct 02 '22 19:10

sensorario