user199588
user199588

Reputation: 539

Include additional library to yii2

There is yii2 which instaled via composer. What specific steps should be taken to connect the additional library library to the current project. Also same question if need connect only simple class.

Upvotes: 1

Views: 673

Answers (2)

Alpesh Panchal
Alpesh Panchal

Reputation: 1713

Composer found at https://getcomposer.org is your best friend while adding new libraries to yii2 framework.

e.g. you would like to add kartik yii2 widgets found at http://demos.krajee.com/ to your yii2 application.

  1. for that you need to have php installed in your development machine and have it accessible via command line. e.g. execute following command from command line to check php version.

php -v

if it works then fine, if not, that you need to set path variable.

  1. download composer.phar from https://getcomposer.org
  2. copy composer.phar to that directory.
  3. go to yii2 application folder using CD through command prompt
  4. execute following command from command line

php composer.phar require kartik-v/yii2-widgets "*"

  1. Now sit and watch it kartik extensions of yii2 will be installed.

To simply connect and using any custom class, follow this guide. http://www.yiiframework.com/wiki/747/write-use-a-custom-component-in-yii2-0/

Yii is mvc framework and it has specific methodology to connect and use with model, view, conntroller. Follow this link to find more http://www.yiiframework.com/doc/guide/1.1/en/basics.mvc

Upvotes: 2

ScaisEdge
ScaisEdge

Reputation: 133400

Normally additional libraries (extensions) are provided with commands for installing the necessary software by composer and instructions on how to configure these modules and components in this initial configuration file. In the advanced template (the organizing schema of the most appropriate code for professional projects) is called main.php and is located in the config directory of each appllicazione (frontend, backend) and in common area accessible to entering for shared configurations. . For what regards the addition of classes .. all what is related to the MVC programming pattern is well organized in the appropriate directory, and then the addition of application classes favors this scheme .. The management of classes or related items can be organized easily into components and modules .........

For all of these and much more you can refer to the guide that is also able to illustrate with concrete examples the many features that characterize Yii.

http://www.yiiframework.com/doc-2.0/guide-index.html

http://www.yiiframework.com/doc-2.0/

Upvotes: 0

Related Questions