阅读(2363) (0)

Laravel 8 根据项目安装

2021-06-22 14:03:07 更新

除了全局安装 Homestead 并且在所有项目共享相同的 Homestead box 之外,你可以为每个项目配置 Homestead 实例。通过在项目下创建 Vagrantfile,其他的项目成员只需运行 vagrant up 就能拥有相同的开发环境。

要将 Homestead 直接安装到项目中,需要使用 Composer 命令:

composer require laravel/homestead --dev

Homestead 安装之后, 使用 make 命令在项目根目录中生成 VagrantfileHomestead.yaml 文件。make 命令会自动配置 Homestead.yaml 文件中的 sitesfolders 指令。

Mac / Linux:

php vendor/bin/homestead make

Windows:

vendor\\bin\\homestead make

接下来,在命令行终端运行 vagrant up 命令,然后在浏览器中访问 http://homestead.test。记住,如果你没有使用自动 主机名解析,在访问之前你仍然需要在 /etc/hosts 文件中添加你的 homestead.test 记录或者其他的域名。