How to use Composer with Yii2

藏色散人
Release: 2019-08-21 14:53:08
forward
3258 people have browsed it

The following column composer usage tutorial will introduce how to use Composer in Yii2. I hope it will be helpful to friends in need!

How to use Composer with Yii2

#composer is a tool used by PHP to manage dependency relationships. You can declare the external tool libraries (libraries) you depend on in your project, and Composer will help you install these dependent library files

composer中文网

http ://www.phpcomposer.com/

Installation path

composer installation path https://getcomposer.org/download/

Installation under Windows

After the composer is successfully installed in windows, the composer.phar file will be generated in the C:\ProgramData\ComposerSetup\bin path.

Could not input open file: composer.phar appears during use. You should check the composer installation directory and environment variable configuration.

Actual operation

Before you need to execute the composer command, you can copy the composer.phar file to the project file and then execute it

So what we want Take the installation of Yii2-admin extension as an example https://github.com/mdmsoft/yii2-admin. We only need to copy composer.phar to the Yii2 project directory, then switch the command line to this directory and execute

php composer.phar require mdmsoft/yii2-admin "~1.0"
Copy after login

The sign of completion is that the vendor adds the mdmsoft source folder, which is the source file of yii2-admin.

The following are the relevant nodes of composer.json

"require": {
        "php": ">=5.4.0",
        "yiisoft/yii2": "*",
        "yiisoft/yii2-bootstrap": "*",
        "yiisoft/yii2-swiftmailer": "*",
        "guzzlehttp/guzzle": "~5.0",
        "mdmsoft/yii2-admin": "~1.0"
    },
Copy after login

The above is the detailed content of How to use Composer with Yii2. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:aliyun.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!