phpstorm配置以及常用操作

一、常用配置
1command+shift+a :查找所有配置
2、去掉编辑与行号的竖线:Code Folding,√去掉
3、去掉命名空间与类之间的横线,phpstorm默认一定会有,去不掉,
但是可以把这个线的颜色跟编辑器背景色弄一样:
Show method separators //将这个√去掉
command+1 //展示、隐藏左侧
4、隐藏右侧竖线:Show right margin,√去掉

二、常用快捷键
1command+shift+o/command+p :查找项目文件
2、ctrl+command+m:查看当前类的所有方法
3command+e:查看最近打开的文件
4、option+command+o:查找某个方法
5、ctrl+shift+f: 指定目录查找字符串
6、ctrl+f:当前文件查找
7command+↑(选择目录)command+n(文件):在对应文件夹创建文件
8、option+command+l :格式化代码
9、选中代码 ctrl+t:代码重构
10、选中某个单词 command+r :批量修改、替换

三、phpstorm使用xdebug
1、先安装xdebug:  brew install homebrew/php/php71-xdebug
2、安装成功 php -v下面会显示xdebug版本号
3、Interpreter错误,指定phpstorm的php版本
4、脚本debug:
    4.1 Run->Edit Con...
    4.2 点 “+”、Php Script、选择脚本OK
    4.3 ctrl+d或者右键debug启动
    【注意】:如果这里提示debug 9000端口冲突,在phpstorm搜索xdebug修改端口号
    4.4、step into(第二个箭头):下一步,有方法会进入方法
5、laravel等项目debug:
    5.1 php --ini 查看xdebug配置文件(ext-xdebug.ini)
    /usr/local/etc/php/7.1/conf.d/ext-xdebug.ini    
    5.2 vim xxxxx/ext-xdebug.ini添加代码如下:
        xdebug.remote_autostart=1
        xdebug.default_enable=1
        xdebug.remote_port=9100 //防止与9000冲突
        xdebug.remote_host=127.0.0.1
        xdebug.remote_connect_back=1
        xdebug.remote_enable=1
        xdebug.idekey=PHPSTORM
    5.3 修改phpstorm中xdebug端口号与这个一样9100
        搜索IDE key: PHPSTORM(与上面设置的一样)
            Host:不需要写
            PORT:9100
    5.4 Run->Edit Con...、点击"+"、选择PHPWebApplication
       Name:tast
       配置server:“+”,当前项目的域名 
           Name:tast.test
           Host:tast.test

四、phpstorm配置全局phpunit   
    1、本地全局安装phpunit  
     wget https://phar.phpunit.de/phpunit.phar
     chmod +x phpunit.phar
     sudo mv phpunit.phar /usr/local/bin/phpunit
     phpunit --version                  

    2、配置phpstorm使用本地全局phpunit
    搜索phpunit
        Use custom autoloader
        Path tox :/usr/local/bin/phpunit

        下面两个√打上
        1)/var/www/site/tast/phpunit.xml
        2)/var/www/site/tast/vendor/autoload.php

    3、配置不使用命令行调用phpunit
        搜索keymap,打开,然后搜索run context,可以看到
        phpstrom跑phpunit快捷键:ctrl+shift+r,所以将鼠标
        光标定位到想要测试的方法体中,按下快捷键即可。







  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值