Mac安装composer安装Yii2项目

【注释:】本人原创,如需转载请注明来源链接!

通过安装Composer方式安装Yii

如果还没有安装 Composer,你可以按 getcomposer.org 中的方法安装。 在 Linux 和 Mac OS X 中,你可以运行如下命令:

curl -sS https://getcomposer.org/installer | php
mv composer.phar /usr/local/bin/composer

步骤:

一、打开终端

二、安装composer:

1、终端输入:curl -sS https://getcomposer.org/installer | php
composer安装成功
2、终端输入:mv composer.phar /usr/local/bin/composer
将composer.phar移动到 /usr/local/bin/composer支持全局访问composer命令
3、验证方法:(注意:需要有访问权限,否则会提示没有权限访问)
输入:composer -v

三、安装Yii2

Composer 安装后,切换到一个可通过 Web 访问的目录,执行如下命令即可安装 Yii :
composer global require "fxp/composer-asset-plugin:^1.2.0"
composer create-project --prefer-dist yiisoft/yii2-app-basic basic
1、终端输入:composer global require "fxp/composer-asset-plugin:^1.2.0"
如果你没有安装Gii该过程会提示你是否安装,安装即可(以下个人项目名称cqy,当然也可以修改成自己想要的项目名称)
2、终端输入:composer create-project --prefer-dist yiisoft/yii2-app-basic cqy
如果出现以下提示:

说明你权限不够,输入sudo -s,提供root权限

有了权限之后重新输入命令,当进行到一半的时候发现需要token

token命令的话需要Github账号来获取3、获取token在使用github获取数据的时候,需要注册一个github账户在账户  Account  -->Setting 点击后页面刷新后, 点击 Personal access tokens,  点击Generate new Token按钮 生成token获取到token后输入即可继续安装,如下:
Token (hidden):
Token stored successfully.
Package operations: 59 installs, 0 updates, 0 removals
  - Installing yiisoft/yii2-composer (2.0.5): Downloading (100%)
  - Installing swiftmailer/swiftmailer (v5.4.7): Downloading (100%)
  - Installing bower-asset/jquery (2.2.4): Downloading (100%)
  - Installing bower-asset/yii2-pjax (v2.0.6): Downloading (100%)
  - Installing bower-asset/punycode (v1.3.2): Downloading (100%)
  - Installing cebe/markdown (1.1.1): Downloading (100%)
  - Installing ezyang/htmlpurifier (v4.9.2): Downloading (100%)
  - Installing bower-asset/jquery.inputmask (3.3.5):Downloading (100%)         )
  - Installing yiisoft/yii2 (2.0.11.2): Downloading (100%)
  - Installing yiisoft/yii2-swiftmailer (2.0.6): Downloading (100%)
  - Installing bower-asset/bootstrap (v3.3.7): Downloading (100%)
  - Installing yiisoft/yii2-bootstrap (2.0.6): Downloading (100%)
  - Installing yiisoft/yii2-debug (2.0.9): Downloading (100%)
  - Installing bower-asset/typeahead.js (v0.11.1): Downloading (100%)
  - Installing phpspec/php-diff (v1.1.0): Downloading (100%)
  - Installing yiisoft/yii2-gii (2.0.5): Downloading (100%)
  - Installing fzaninotto/faker (v1.6.0): Downloading (100%)
  - Installing yiisoft/yii2-faker (2.0.3): Downloading (100%)
  - Installing psr/log (1.0.2): Downloading (100%)
  - Installing symfony/debug (v3.2.7): Downloading (100%)
  - Installing symfony/polyfill-mbstring (v1.3.0): Downloading (100%)
  - Installing symfony/console (v3.2.7): Downloading (100%)
  - Installing stecman/symfony-console-completion (0.7.0): Downloading (100%)     - Installing sebastian/diff (1.4.1): Downloading (100%)
  - Installing sebastian/recursion-context (2.0.0): Downloading (100%)
  - Installing sebastian/exporter (2.0.0): Downloading (100%)
  - Installing sebastian/comparator (1.2.4): Downloading (100%)
  - Installing behat/gherkin (v4.4.5): Downloading (100%)
  - Installing symfony/dom-crawler (v3.2.7): Downloading (100%)
  - Installing symfony/css-selector (v3.2.7): Downloading (100%)
  - Installing symfony/browser-kit (v3.2.7): Downloading (100%)
  - Installing symfony/yaml (v3.2.7): Downloading (100%)
  - Installing symfony/event-dispatcher (v3.2.7): Downloading (100%)
  - Installing symfony/finder (v3.2.7): Downloading (100%)
  - Installing psr/http-message (1.0.1): Downloading (100%)
  - Installing guzzlehttp/psr7 (1.4.2): Downloading (100%)
  - Installing sebastian/version (2.0.1): Downloading (100%)
  - Installing sebastian/environment (2.0.0): Downloading (100%)
  - Installing sebastian/code-unit-reverse-lookup (1.0.1): Downloading (100%)     - Installing phpunit/php-token-stream (1.4.11): Downloading (100%)
  - Installing phpunit/php-text-template (1.2.1): Downloading (100%)
  - Installing phpunit/php-file-iterator (1.4.2): Downloading (100%)
  - Installing phpunit/php-code-coverage (4.0.8): Downloading (100%)
  - Installing sebastian/resource-operations (1.0.0): Downloading (100%)          - Installing sebastian/object-enumerator (2.0.1): Downloading (100%)
  - Installing sebastian/global-state (1.1.1): Downloading (100%)
  - Installing doctrine/instantiator (1.0.5): Downloading (100%)
  - Installing phpunit/phpunit-mock-objects (3.4.3):Downloading (100%)         )
  - Installing phpunit/php-timer (1.0.9): Downloading (100%)
  - Installing webmozart/assert (1.2.0): Downloading (100%)
  - Installing phpdocumentor/reflection-common (1.0): Downloading (100%)          - Installing phpdocumentor/type-resolver (0.2.1): Downloading (100%)
  - Installing phpdocumentor/reflection-docblock (3.1.1): Downloading (100%)      - Installing phpspec/prophecy (v1.7.0): Downloading (100%)
  - Installing myclabs/deep-copy (1.6.1): Downloading (100%)
  - Installing phpunit/phpunit (5.7.19): Downloading (100%)
  - Installing codeception/base (2.2.10): Downloading (100%)
  - Installing codeception/verify (0.3.3): Downloading (100%)
  - Installing codeception/specify (0.4.6): Downloading (100%)
symfony/console suggests installing symfony/filesystem ()
symfony/console suggests installing symfony/process ()
symfony/browser-kit suggests installing symfony/process ()
symfony/event-dispatcher suggests installing symfony/dependency-injection ()
symfony/event-dispatcher suggests installing symfony/http-kernel ()
phpunit/php-code-coverage suggests installing ext-xdebug (^2.5.1)
sebastian/global-state suggests installing ext-uopz (*)
phpunit/phpunit suggests installing phpunit/php-invoker (~1.1)
phpunit/phpunit suggests installing ext-xdebug (*)
codeception/base suggests installing flow/jsonpath (For using JSONPath in REST module)
codeception/base suggests installing phpseclib/phpseclib (for SFTP option in FTP Module)
codeception/base suggests installing league/factory-muffin (For DataFactory module)
codeception/base suggests installing league/factory-muffin-faker (For Faker support in DataFactory module)
codeception/base suggests installing symfony/phpunit-bridge (For phpunit-bridge support)
Writing lock file
Generating autoload files
> yii\composer\Installer::postCreateProject
chmod(‘runtime‘, 0777)...done.
chmod(‘web/assets‘, 0777)...done.
chmod(‘yii‘, 0755)...done.
安装成功!
				
时间: 2024-12-28 04:54:57

Mac安装composer安装Yii2项目的相关文章

使用Composer构建Yii2项目

1.安装composer curl -sS https://getcomposer.org/installer | php sudo mv composer.phar /usr/local/bin/composer 参考http://docs.phpcomposer.com/00-intro.html#Globally-on-OSX-via-homebrew 2.使用composer 构建项目 进入指定目录执行 composer create-project --prefer-dist --st

laravel 安装 composer 安装

laravel 如何安装?新手操作 有什么不对的地方 请多多指点 废话不多说 laravel 安装 需要在composer 下面安装 所以分两步 一.安装composer 1.下载composer资源 https://getcomposer.org/download/   这是国外资源 下载composer之前先下个FQ软件(如Lantern)并打开. 将下载好的文件放到php目录下. 新建一个composer.bat文件(放在php目录下),在里面写入一下内容: @php "%~dp0comp

composer 更新YII2项目错误

1.使用CMD命令 运行至文件目录执行 composer install 或 composer update  出现如下异常 yiisoft/yii2 2.0.2 requires bower-asset/jquery [email protected] |1.11.  ..... 解决方法: 运行:composer global require "fxp/composer-asset-plugin:1.0.0" 再执行 composer update 即可.

YII2.0版本框架利用composer安装

本人YII2.0框架安装心得,说多都是泪,直接上图,遇到的问题,给大家分享,不喜勿喷 一.  在安装YII2.0首先我们需要下载一个composer,何为composer,简单解释为PHP的组件工具, Composer是PHP中用来管理依赖(dependency)关系的工具,你可以在自己的项目中声明所依赖的外部工具库(libraries),Composer会帮你安装这些依赖的库文件. Composer 下载地址  https://getcomposer.org/download/ 本人的环境是p

composer.json:项目安装

基本用法 基本用法 安装 composer.json:项目安装 关于 require Key 包名称 包版本 下一个重要版本(波浪号运算符) 稳定性 安装依赖包 composer.lock - 锁文件 Packagist 自动加载 安装 安装 Composer,你只需要下载 composer.phar 可执行文件. curl -sS https://getcomposer.org/installer | php 详细请查看 简介 章节. 要检查 Composer 是否正常工作,只需要通过 php

composer安装学习

Packagist 镜像 网站地址 http://www.phpcomposer.com/ 请各位使用本镜像的同学注意: 本镜像已经依照 composer 官方的数据源安全策略完全升级并支持 https 协议!请各位同学 按照下面所示的两个方法将 http://packagist.phpcomposer.com 修改为https://packagist.phpcomposer.com 还没安装 composer 吗?请往下看如何安装 composer . 用法: 有两种方式启用本镜像服务: 系统

composer安装Laravel5

Composer简介 包管理器 PHP   ====>  phar 依赖处理容易出现问题 配置及命令行接口复杂 是PHP依赖管理工具,而非包管理器.涉及到packages(包)和libraries(库) 在项目中声明外部所依赖的外部工具libraries(库),composer会自动安装 官网: https://getcomposer.org 中文网:http://www.phpcomposer.com 安装Composer 安装方式 Composer-Setup.exe 需FQ (window

Linux rabbitmq的安装和安装amqp的php插件

RabbitMQ是一个消息代理.它的核心原理非常简单:接收和发送消息.你可以把它想像成一个邮局:你把信件放入邮箱,邮递员就会把信件投递到你的收件人处.在这个比喻中,RabbitMQ是一个邮箱.邮局.邮递员.RabbitMQ和邮局的主要区别是,它处理的不是纸,而是接收.存储和发送二进制的数据——消息. 第一步 安装erlang rabbitmq的依赖 wget http://www.erlang.org/download/otp_src_17.4.tar.gztar -zxvf otp_src_1

YII2 项目安装步骤及异常记录

项目环境: 操作系统:windows 7 版本管理:git 该项目我是在mac上面创建的,mac上面的环境也是一波三折啊!但我同事的环境是在windows上面,因为是前端同学,所以只好我再次操刀了... 1.clone代码到本地 先是从代码托管平台上面把项目clone到本地,这步没有任何问题. 2.添加各种环境变量 我一共是添加了php.composer以及git这三个环境变量,这步也问题不大. 主要是composer的安装,我是参照官网手动安装,官网可能要fan qiang才能访问.我把他代码