PHP
laravel
homestead

使いたいPHPバージョンに合わせて Laravel Homestead を選ぼう

More than 1 year has passed since last update.

Laravel Homestead の第3の使い方で紹介した方法を使うと、Homestead のバージョンによってインストールされるPHPのバージョンも切り替えることができます。

homestead Ubuntu PHP MySQL
2.2.2 14.04.3 LTS PHP 5.6.13-1 mysql Ver 14.14 Distrib 5.6.19
3.1.0 16.04.1 LTS PHP 7.0.13-1 mysql Ver 14.14 Distrib 5.7.16
4.0.3 16.04.1 LTS PHP 7.1.0-2 mysql Ver 14.14 Distrib 5.7.16

PHP 5.6

composer.json
{
    "require-dev": {
        "laravel/homestead": "^2.0"
    }
}
$ php -v
PHP 5.6.13-1+deb.sury.org~trusty+3 (cli)
Copyright (c) 1997-2015 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2015 Zend Technologies
    with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2015, by Zend Technologies
    with Xdebug v2.3.2, Copyright (c) 2002-2015, by Derick Rethans
    with blackfire v1.4.1, https://blackfire.io/, by SensioLabs

PHP7.0

composer.json
{
    "require-dev": {
        "laravel/homestead": "^3.0"
    }
}
homestead.yaml
---
ip: "192.168.10.10"
memory: 2048
cpus: 1
hostname: homestead
name: homestead
provider: virtualbox
version: 0.6.0  # boxバージョン指定が必要
$ php -v
PHP 7.0.13-1+deb.sury.org~xenial+1 (cli) ( NTS )
Copyright (c) 1997-2016 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies
    with Zend OPcache v7.0.13-1+deb.sury.org~xenial+1, Copyright (c) 1999-2016, by Zend Technologies
    with blackfire v1.14.1~linux-x64-non_zts70, https://blackfire.io, by Blackfireio Inc.

PHP7.1

composer.json
{
    "require-dev": {
        "laravel/homestead": "^4.0"
    }
}
$ php -v
PHP 7.1.0-2+deb.sury.org~xenial+1 (cli) ( NTS )
Copyright (c) 1997-2016 The PHP Group
Zend Engine v3.1.0-dev, Copyright (c) 1998-2016 Zend Technologies
    with Zend OPcache v7.1.0-2+deb.sury.org~xenial+1, Copyright (c) 1999-2016, by Zend Technologies
    with blackfire v1.14.1~linux-x64-non_zts71, https://blackfire.io, by Blackfireio Inc.