参考文档:
一、Mac Install
//php 安装
brew install php
//composer 安装
curl -sS https://getcomposer.org/installer | php
composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/
//Laravel 安装
composer global require laravel/installer
//修改 环境变量 macOS: $HOME/.composer/vendor/bin
//在文件里面增加export PATH=/Users/xxx/.composer/vendor/bin:$PATH
open ~/.bash_profile
source ./.bash_profile
二、例子Demo
借用OneDrive 官方例子 : msgraph-training-phpapp
//创建新项目
//laravel new graph-tutorial
//下载依赖
composer install
//开启服务
php artisan serve
浏览器访问 http://localhost:8000/
三、Error
1.composer 一直卡在 compser install
可以使用阿里巴巴提供的 Composer 全量镜像 mirrors.aliyun.com/composer/
a). 配置只在当前项目生效
composer config repo.packagist composer https://mirrors.aliyun.com/composer/
# 取消当前项目配置
composer config --unset repos.packagist
a). 配置全局生效
composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/
# 取消全局配置
composer config -g --unset repos.packagist
2.laravel 500 Server Error
1.修改项目里的 /config/app.php 把debug 改成true
'debug' => (bool) env('APP_DEBUG', true),
2.生存AppKey 本地服务器提示MissingAppKeyException
Illuminate\Encryption\MissingAppKeyException
No application encryption key has been specified.
//项目里找到隐藏文件.env.example 复制重命名为.env 然后执行命令
php artisan key:generate