composer是PHP的插件依赖管理工具,我个人感觉和java的Maven、Gradle很类似。
Windows OS下安装composer
参考:
https://www.php.cn/php-weizijiaocheng-400785.html
https://blog.csdn.net/Zhihua_W/article/details/80407703
composer模板
在项目根目录下创建一个:
composer.json
{
"name": "nightP",
"description": "PHP Framework",
"type": "PHP Framework",
"require": {
"php": ">=5.3.0",
"filp/whoops": "*",
"symfony/var-dumper": "*",
"catfan/medoo": "*",
"twig/twig": "*"
},
"repositories": {
"packagist": {
"type": "composer",
"url": "https://packagist.phpcomposer.com"
}
}
}
第一次安装插件
cd进到项目目录,使用命令
composer install
添加插件
composer update
命令行安装
不需要配置composer.json文件,只需要进入项目根路径,然后使用composer require Xxx
即可。
composer require "almasaeed2010/adminlte=~2.0"