• PHP Yii2 composer环境安装


    PHP Yii2 composer环境安装

    composer 安装

    任意目录执行:
    php -r "copy('https://install.phpcomposer.com/installer', 'composer-setup.php');"
    执行安装
    php composer-setup.php
    安装完成之后可以删除安装文件
    php -r "unlink('composer-setup.php');"
    将composer设置成全局命令
    mv composer.phar /usr/local/bin/composer
    使用国内镜像
    composer config -g repo.packagist composer https://packagist.phpcomposer.com

    Yii2 安装

    安装yii2的前端依赖包
    composer global require "fxp/composer-asset-plugin:^1.4.0"
    若提示如下报错,修改php.ini配置参数disable_functions,注释此行或启用escapeshellcmd方法

    [ErrorException]
    capeshellarg() has been disabled for security reasons

    安装Yii2
    composer create-project yiisoft/yii2-app-advanced /usr/local/yii2 2.0.13
    /usr/local/yii2为约定的yii2框架目录,yii2最终会被安装到此目录,提示如下报错,重新执行命令

    [ComposerRepositoryInvalidRepositoryException] No valid bower.json was found in any branch or tag of https://github.com/twitter/typeahead.js.git, could not load a package from it.

    vim /usr/local/yii2/composer.json
    "config": {
            "process-timeout": 1800,
            "github-oauth": {
              "github.com": "此处输入您的github授权码"
              }
        },
    

    composer 升级
    cd /usr/local/yii2/
    composer update

    安装可能提示输入github token,登录github生成一个填上回车即可

    将yii2镜像地址换为国内镜像

    cd /usr/local/yii2/
    composer config repo.packagist composer https://packagist.phpcomposer.com

    依赖包的安装

    cd /usr/local/yii2
    #安装redis扩展包
    composer require --prefer-dist yiisoft/yii2-redis 
    #安装curl扩展包
    composer require --prefer-dist linslin/yii2-curl "*"
    #邮件扩展包,不是必须
    composer require --prefer-dist yiisoft/yii2-swiftmailer
    #日期选择器挂件依赖包
    composer require kartik-v/yii2-widget-datetimepicker "*" 
    

    升级及管理

    composer update yiisoft/yii2 yiisoft/yii2-composer bower-asset/jquery.inputmask

  • 相关阅读:
    AdminLTE模板
    日历插件
    Jquery 拖拽表格宽度
    Java桌面程序打包成exe可执行文件
    使用Access-Control-Allow-Origin解决跨域
    Ubuntu默认root密码
    Lua的require和module小结
    nginx 安装
    chkconfig命令
    [转]fedora启动telnet服务
  • 原文地址:https://www.cnblogs.com/Mrhuangrui/p/8557062.html
Copyright © 2020-2023  润新知