您的位置:首页 > 编程语言 > PHP开发

Composer(PHP依赖管理工具)安装

2014-12-26 17:36 621 查看
http://docs.phpcomposer.com/00-intro.md#Installation-*nix

切换到项目目录。增加文件:
[root@localhost html]# vi composer.json
{
"require": {
"monolog/monolog": "1.0.*"
}
}

由于composer是安装在/root下的,所以在项目下,我们这样执行:
[root@localhost html]# php /root/composer.phar install
Loading composer repositories with package information
Installing dependencies (including require-dev)
- Installing monolog/monolog (1.0.2)
Loading from cache

Writing lock file
Generating autoload files

项目文件a.php中可以增加这行语句,进行自动加载composer下载的包类:
[root@localhost html]# vi /var/www/html/a.php
<?php
require 'vendor/autoload.php';

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: