Include additional library to yii2

China☆狼群 提交于 2019-12-13 01:25:36

问题


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.


回答1:


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




回答2:


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/



来源:https://stackoverflow.com/questions/35384920/include-additional-library-to-yii2

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!