本文经授权转自 PHPHub 社区
链接
- Homestead 环境部署脚本 - 使用此脚本来构造 Homestead box 的
- Homestead 主项目 repo - Homestea 是一个 Vagrant 项目
- Homestead 文档
- Vagrant 的盒子相关操作文档
- Homestead 所有版本列表
- 百度盘 Homestead 主要版本下载
Homestead Box 版本
默认使用命令:
vagrant box add laravel/homestead
安装的盒子是最新版本,如当前最新版本的 Homestead 为 v0.4.4。
Laravel 社区对新技术保持比较开放的姿态,所以 Homestead 的最新版一般都使用比较新的软件,如 PHP7,推崇 HHVM,MYSQL 5.7 等。
如果你因特殊原因,想使用老版本的话,如项目需要使用 PHP5.6(v0.3.3 版本)。
Homestead 的所有 box 版本信息:https://atlas.hashicorp.com/laravel/boxes/homestead/
下载指定版本的命令:
$ vagrant box add laravel/homestead --box-version=0.3.3$ vagrant box add laravel/homestead --box-version=0.2.7
file
上面的几个版本可前往百度盘下载:http://pan.baidu.com/s/1hrN55w4
下载加速
国内因为网络的原因,默认的盒子安装命令 vagrant box add laravel/homestead 变得不适用。
你可以使用以下方法来加速下载和添加盒子。
1. 下载链接
首先获取盒子最终下载链接:

然后就可以使用第三方多线程,支持断点续传的工具进行下载了。
注意,请勿使用迅雷离线下载,亲测下载后的文件会损坏。
我把目前几个大版本下载上传到百度盘,可前往下载 -> http://pan.baidu.com/s/1o7KB2ZK 。
附上文件的 CheckSum:
➜ Boxes openssl sha1 homestead-virtualbox-0.2.7.boxSHA1(homestead-virtualbox-0.2.7.box)= 76e67b203a39f77d617ad9ed00d2aec0c79e7680➜ Boxes openssl sha1 homestead-virtualbox-0.4.4.boxSHA1(homestead-virtualbox-0.4.4.box)= 059821e503c5441e9243edd687e061e5ce0a1bec➜ Boxes openssl sha1 homestead-virtualbox-0.3.3.boxSHA1(homestead-virtualbox-0.3.3.box)= 41967c26e7fd8b0fae84c3ecbd0e4058c0ab2bb1
2. 导入盒子
下载下来的 .box 文件,可以使用以下方法导入:
在 .box 的同文件夹下创建一个 metadata.json 文件,内容为以下
{ "name": "laravel/homestead", "versions": [ { "version": "0.4.4", "providers": [ { "name": "virtualbox", "url": "homestead-virtualbox-0.4.4.box" } ] } ]}
字段说明
- version - 可以指定当前盒子导入的版本标示;
- url - 支持 绝对文件路径 和 相对文件路径
运行以下命令导入:
vagrant box add metadata.json
运行 list 命令查看是否添加成功:
vagrant box list
操作截图:
file
感谢 @solarhell 提供的此方法,他的博文 - 使用Homestead搭建开发环境。
Homestead 版本
所有的 homestead 历史版本可以在这里看到:https://github.com/laravel/homestead/releases 。
使用以下命令可查看 homestead 版本:
$ homestead -versionLaravel Homestead version 2.2.1
安装 homestead 特定版本:
$ composer global require "laravel/homestead:~2.2.0"
删除 homestead 之前的版本,然后使用最新版本:
$ composer global remove laravel/homestead$ composer global clear-cache$ composer global require laravel/homestead$ vagrant destroy && vagrant up

DependencyInjection(DI)inPHPenhancescodeflexibilityandtestabilitybydecouplingdependencycreationfromusage.ToimplementDIeffectively:1)UseDIcontainersjudiciouslytoavoidover-engineering.2)Avoidconstructoroverloadbylimitingdependenciestothreeorfour.3)Adhe

ToimproveyourPHPwebsite'sperformance,usethesestrategies:1)ImplementopcodecachingwithOPcachetospeedupscriptinterpretation.2)Optimizedatabasequeriesbyselectingonlynecessaryfields.3)UsecachingsystemslikeRedisorMemcachedtoreducedatabaseload.4)Applyasynch

Yes,itispossibletosendmassemailswithPHP.1)UselibrarieslikePHPMailerorSwiftMailerforefficientemailsending.2)Implementdelaysbetweenemailstoavoidspamflags.3)Personalizeemailsusingdynamiccontenttoimproveengagement.4)UsequeuesystemslikeRabbitMQorRedisforb

DependencyInjection(DI)inPHPisadesignpatternthatachievesInversionofControl(IoC)byallowingdependenciestobeinjectedintoclasses,enhancingmodularity,testability,andflexibility.DIdecouplesclassesfromspecificimplementations,makingcodemoremanageableandadapt

The best ways to send emails using PHP include: 1. Use PHP's mail() function to basic sending; 2. Use PHPMailer library to send more complex HTML mail; 3. Use transactional mail services such as SendGrid to improve reliability and analysis capabilities. With these methods, you can ensure that emails not only reach the inbox, but also attract recipients.

Calculating the total number of elements in a PHP multidimensional array can be done using recursive or iterative methods. 1. The recursive method counts by traversing the array and recursively processing nested arrays. 2. The iterative method uses the stack to simulate recursion to avoid depth problems. 3. The array_walk_recursive function can also be implemented, but it requires manual counting.

In PHP, the characteristic of a do-while loop is to ensure that the loop body is executed at least once, and then decide whether to continue the loop based on the conditions. 1) It executes the loop body before conditional checking, suitable for scenarios where operations need to be performed at least once, such as user input verification and menu systems. 2) However, the syntax of the do-while loop can cause confusion among newbies and may add unnecessary performance overhead.

Efficient hashing strings in PHP can use the following methods: 1. Use the md5 function for fast hashing, but is not suitable for password storage. 2. Use the sha256 function to improve security. 3. Use the password_hash function to process passwords to provide the highest security and convenience.


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

SublimeText3 Linux new version
SublimeText3 Linux latest version

SublimeText3 English version
Recommended: Win version, supports code prompts!

Notepad++7.3.1
Easy-to-use and free code editor

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.
