先安装composer: brew install composer
通过composer安装laravel: composer global require "laravel/installer"

然后编辑.bashrc:

1
2
3
vim ~/.bash_profile
export PATH="~/.composer/vendor/bin:$PATH"
source ~/.bash_profile

PhpStorm代码提示laravel

composer require barryvdh/laravel-ide-helper
然后到找到 config/app.php 里面的providers最下面写如Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider::class,
最后执行php artisan ide-helper:generate

composer国内加速

在composer.json添加以下代码

1
2
3
4
5
6
{
"repositories": [
{"type": "composer", "url": "http://packagist.phpcomposer.com"},
{"packagist": false}
]
}

global composer 更新

1
2
cd /Users/username/.composer
composer update