Laraval环境搭建
更换终端
shell 安装 oh-my-zsh 主题,默认shell为 zsh 而不是 bash
sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
重新打开终端,默认为 zsh
安装Composer
进入官网下载:https://getcomposer.org ,下载最新版本
下载后得到可执行文件 composer.phar
授权所有用户可执行
移动到环境目录,并改名为:composer
➜ ~ sudo mv composer.phar /usr/bin/composer Password: ➜ ~ composer -V Composer version 1.9-dev (1.9-dev+bfba228b5a232bcb9e4bb7941f0a0aaa37bab117) 2019-08-13 15:28:15 ➜ ~
配置阿里云镜像地址
➜ ~ composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/ ➜ ~ composer clear-cache Cache directory does not exist (cache-vcs-dir): Cache directory does not exist (cache-repo-dir): Cache directory does not exist (cache-files-dir): Clearing cache (cache-dir): /Users/zgh/.composer/cache All caches cleared. ➜ ~
配置多线程并行下载
➜ ~ composer global require hirak/prestissimo
测试下载,可以看到使用阿里云镜像地址,而且是并行下载
➜ ~ composer create-project laravel/laravel blog -vvv
创建laravel项目
创建laravel版本为5.7.x,项目名为weiBo的项目
➜ code composer create-project --prefer-dist laravel/laravel weiBo "5.7.*"
运行项目
➜ code cd weiBo
➜ weiBo cp .env.example .env ➜ weiBo php artisan key:generate Application key set successfully.
➜ weiBo php artisan serve Laravel development server started: <http://127.0.0.1:8000>
浏览器访问 http://127.0.0.1:8000
初始化 git,创建git仓库时不用初始化 readme.md文件,因为laravel已经创建好了
➜ weiBo git init Initialized empty Git repository in /Users/gh/code/weiBo/.git/ ➜ weiBo git:(master) ✗ git add -A ➜ weiBo git:(master) ✗ git commit -am "初始化" [master (root-commit) 5801827] 初始化 ➜ weiBo git:(master) git remote add origin git@gitee.com:GH16/Laravel_weibo.git ➜ weiBo git:(master) git push -u origin master