Blogger Information
Blog 119
fans 3
comment 1
visits 94676
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
PHP Composer - 依赖管理
赵大叔
Original
722 people have browsed it

Composer常用命令

1、安装Composer macOS:

  • 准备工作: composer要求 php 5.3以上
  • php -v:查看版本
  • 下载composer应用程序: curl -sS https://getcomposer.org/installer | php
  • 安装composer到全局:sudo mv composer.phar /usr/local/bin/composer
  • 终端输入 composer:检查是否安装成功

2、Composer常用命令

[https://docs.phpcomposer.com/03-cli.html#Command-line-interface]

STT 命令
1 安装 php composer.phar install
2 更新 php composer.phar update
3 申明依赖 php composer.phar require
4 搜索 php composer.phar search + '项目名'
5 展示 php composer.phar show
6 自我更新 php composer.phar self-update
7 创建项目 composer create-project + '项目名'

3、 使用composer

地址:https://packagist.org/搜索项目
执行终端命令前要先选中要下载到的目录:cd …

3.1 验证码组件

  1. <?php
  2. namespace php_cn;
  3. use Gregwar\Captcha\CaptchaBuilder;
  4. require 'vendor/autoload.php';
  5. $builder = new CaptchaBuilder(6);
  6. $builder->build();
  7. $captcha = $builder->inline();
  8. echo '<img src="'.$captcha.'" />';

3.2 laraval框架

composer安装laraval框架成功结果:

laraval框架目录:

配置站点成功:

总结:composer最常用的我想应该是安装组件吧,至于安装好以后怎么用,怎么更新、修改,应该就是我们自己的事了。

Correcting teacher:天蓬老师天蓬老师

Correction status:qualified

Teacher's comments:就把composer想象成你电脑中的360软件管家就可以, 功能类似, 本质就让你省事变懒, 把注意力转移到项目上, 而不被这些东西困扰
Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post