Skip to content

Commit 8b79afd

Browse files
committed
working on homestead docs
1 parent 04969c6 commit 8b79afd

File tree

2 files changed

+33
-65
lines changed

2 files changed

+33
-65
lines changed

configuration.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
- [Introduction](#introduction)
44
- [Accessing Configuration Values](#accessing-configuration-values)
55
- [Environment Configuration](#environment-configuration)
6-
- [Accessing The Current Environment](#accessing-the-current-environment)
6+
- [Determining The Current Environment](#determining-the-current-environment)
77
- [Configuration Caching](#configuration-caching)
88
- [Maintenance Mode](#maintenance-mode)
99

@@ -40,8 +40,8 @@ Your `.env` file should not be committed to your application's source control, s
4040

4141
If you are developing with a team, you may wish to continue including a `.env.example` file with your application. By putting place-holder values in the example configuration file, other developers on your team can clearly see which environment variables are needed to run your application.
4242

43-
<a name="accessing-the-current-environment"></a>
44-
### Accessing The Current Environment
43+
<a name="determining-the-current-environment"></a>
44+
### Determining The Current Environment
4545

4646
The current application environment is determined via the `APP_ENV` variable from your `.env` file. You may access this value via the `environment` method on the `App` [facade](/docs/{{version}}/facades):
4747

homestead.md

+30-62
Original file line numberDiff line numberDiff line change
@@ -7,45 +7,42 @@
77
- [Launching The Vagrant Box](#launching-the-vagrant-box)
88
- [Per Project Installation](#per-project-installation)
99
- [Daily Usage](#daily-usage)
10+
- [Accessing Homestead Globally](#accessing-homestead-globally)
1011
- [Connecting Via SSH](#connecting-via-ssh)
1112
- [Connecting To Databases](#connecting-to-databases)
1213
- [Adding Additional Sites](#adding-additional-sites)
1314
- [Configuring Cron Schedules](#configuring-cron-schedules)
1415
- [Ports](#ports)
15-
- [Bash Aliases](#bash-aliases)
1616
- [Blackfire Profiler](#blackfire-profiler)
1717

1818
<a name="introduction"></a>
1919
## Introduction
2020

2121
Laravel strives to make the entire PHP development experience delightful, including your local development environment. [Vagrant](http://vagrantup.com) provides a simple, elegant way to manage and provision Virtual Machines.
2222

23-
Laravel Homestead is an official, pre-packaged Vagrant "box" that provides you a wonderful development environment without requiring you to install PHP, HHVM, a web server, and any other server software on your local machine. No more worrying about messing up your operating system! Vagrant boxes are completely disposable. If something goes wrong, you can destroy and re-create the box in minutes!
23+
Laravel Homestead is an official, pre-packaged Vagrant box that provides you a wonderful development environment without requiring you to install PHP, HHVM, a web server, and any other server software on your local machine. No more worrying about messing up your operating system! Vagrant boxes are completely disposable. If something goes wrong, you can destroy and re-create the box in minutes!
2424

25-
Homestead runs on any Windows, Mac, or Linux system, and includes the Nginx web server, PHP 5.6, MySQL, Postgres, Redis, Memcached, Node, and all of the other goodies you need to develop amazing Laravel applications.
25+
Homestead runs on any Windows, Mac, or Linux system, and includes the Nginx web server, PHP 7.0, MySQL, Postgres, Redis, Memcached, Node, and all of the other goodies you need to develop amazing Laravel applications.
2626

2727
> **Note:** If you are using Windows, you may need to enable hardware virtualization (VT-x). It can usually be enabled via your BIOS.
2828
29-
Homestead is currently built and tested using Vagrant 1.7.
30-
3129
<a name="included-software"></a>
3230
### Included Software
3331

3432
- Ubuntu 14.04
3533
- Git
36-
- PHP 5.6 / 7.0
37-
- Xdebug
34+
- PHP 7.0
3835
- HHVM
36+
- Xdebug
3937
- Nginx
4038
- MySQL
4139
- Sqlite3
4240
- Postgres
4341
- Composer
4442
- Node (With PM2, Bower, Grunt, and Gulp)
4543
- Redis
46-
- Memcached (PHP 5.x Only)
44+
- Memcached
4745
- Beanstalkd
48-
- [Laravel Envoy](/docs/{{version}}/envoy)
4946
- [Blackfire Profiler](#blackfire-profiler)
5047

5148
<a name="installation-and-setup"></a>
@@ -56,66 +53,37 @@ Homestead is currently built and tested using Vagrant 1.7.
5653

5754
Before launching your Homestead environment, you must install [VirtualBox 5.x](https://www.virtualbox.org/wiki/Downloads) or [VMWare](http://www.vmware.com) as well as [Vagrant](http://www.vagrantup.com/downloads.html). All of these software packages provide easy-to-use visual installers for all popular operating systems.
5855

59-
To use the VMware provider, you will need to purchase both VMware Fusion / Workstation and the [VMware Vagrant plug-in](http://www.vagrantup.com/vmware). VMware provides much faster shared folder performance out of the box.
56+
To use the VMware provider, you will need to purchase both VMware Fusion / Workstation and the [VMware Vagrant plug-in](http://www.vagrantup.com/vmware). Though it is not free, VMware can provide faster shared folder performance out of the box.
6057

6158
#### Installing The Homestead Vagrant Box
6259

6360
Once VirtualBox / VMware and Vagrant have been installed, you should add the `laravel/homestead` box to your Vagrant installation using the following command in your terminal. It will take a few minutes to download the box, depending on your Internet connection speed:
6461

6562
vagrant box add laravel/homestead
6663

67-
If this command fails, you may have an old version of Vagrant that requires the full URL:
68-
69-
vagrant box add laravel/homestead https://atlas.hashicorp.com/laravel/boxes/homestead
64+
If this command fails, make sure your Vagrant installation is up to date.
7065

71-
#### Cloning The Homestead Repository
66+
#### Installing Homestead
7267

7368
You may install Homestead by simply cloning the repository. Consider cloning the repository into a `Homestead` folder within your "home" directory, as the Homestead box will serve as the host to all of your Laravel projects:
7469

75-
git clone https://github.com/laravel/homestead.git Homestead
76-
77-
If you would like to try the PHP 7.0 version of Homestead, clone the `php-7` branch of the repository:
70+
cd ~
7871

79-
git clone -b php-7 https://github.com/laravel/homestead.git Homestead
72+
git clone https://github.com/laravel/homestead.git Homestead
8073

81-
Once you have cloned the Homestead repository, run the `bash init.sh` command from the Homestead directory to create the `Homestead.yaml` configuration file. The `Homestead.yaml` file will be placed in your `~/.homestead` directory:
74+
Once you have cloned the Homestead repository, run the `bash init.sh` command from the Homestead directory to create the `Homestead.yaml` configuration file. The `Homestead.yaml` file will be placed in the `~/.homestead` hidden directory:
8275

8376
bash init.sh
8477

85-
<a name="upgrading-to-php-7"></a>
86-
#### Upgrading To PHP 7.0
87-
88-
If you are already using the PHP 5.x Homestead box, you may easily upgrade your installation to PHP 7.0. First, clone the `php-7` branch of the `laravel/homestead` repository into a new folder:
89-
90-
git clone -b php-7 https://github.com/laravel/homestead.git Homestead7
91-
92-
If you already have a `Homestead.yaml` file in your `~/.homestead` directory, there is no need to run the `init.sh` script. However, if this is the first and only Homestead installation on your machine, you should run `bash init.sh` from your new Homestead directory.
93-
94-
Next, add then the `box` directive to the top of your `~/.homestead/Homestead.yaml` file (on a new line after `---` mark):
95-
96-
box: laravel/homestead-7
97-
98-
Finally, you may run the `vagrant up` command from the directory that contains your new clone of the `laravel/homestead` repository.
99-
10078
<a name="configuring-homestead"></a>
10179
### Configuring Homestead
10280

10381
#### Setting Your Provider
10482

105-
The `provider` key in your `Homestead.yaml` file indicates which Vagrant provider should be used: `virtualbox`, `vmware_fusion`, or `vmware_workstation`. You may set this to whichever provider you prefer:
83+
The `provider` key in your `~/.homestead/Homestead.yaml` file indicates which Vagrant provider should be used: `virtualbox`, `vmware_fusion`, or `vmware_workstation`. You may set this to the provider you prefer:
10684

10785
provider: virtualbox
10886

109-
#### Setting Your SSH Key
110-
111-
In the `Homestead.yaml` file, you should also configure the path to your public SSH key. Don't have an SSH key? On Mac and Linux, you can generally create an SSH key pair using the following command:
112-
113-
ssh-keygen -t rsa -C "you@homestead"
114-
115-
On Windows, you may install [Git](http://git-scm.com/) and use the "Git Bash" shell included with Git to issue the command above. Alternatively, you may use [PuTTY](http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html) and [PuTTYgen](http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html).
116-
117-
Once you have created a SSH key, specify the public key's path in the `authorize` property of your `Homestead.yaml` file.
118-
11987
#### Configuring Shared Folders
12088

12189
The `folders` property of the `Homestead.yaml` file lists all of the folders you wish to share with your Homestead environment. As files within these folders are changed, they will be kept in sync between your local machine and the Homestead environment. You may configure as many shared folders as necessary:
@@ -146,15 +114,13 @@ You can make any Homestead site use [HHVM](http://hhvm.com) by setting the `hhvm
146114
to: /home/vagrant/Code/Laravel/public
147115
hhvm: true
148116

149-
By default, each site will be accessible by HTTP via port 8000 and HTTPS via port 44300.
150-
151117
#### The Hosts File
152118

153-
Don't forget to add the "domains" for your Nginx sites to the `hosts` file on your machine! The `hosts` file will redirect your requests for the local domains into your Homestead environment. On Mac and Linux, this file is located at `/etc/hosts`. On Windows, it is located at `C:\Windows\System32\drivers\etc\hosts`. The lines you add to this file will look like the following:
119+
You must add the "domains" for your Nginx sites to the `hosts` file on your machine. The `hosts` file will redirect your requests for the local domains into your Homestead environment. On Mac and Linux, this file is located at `/etc/hosts`. On Windows, it is located at `C:\Windows\System32\drivers\etc\hosts`. The lines you add to this file will look like the following:
154120

155121
192.168.10.10 homestead.app
156122

157-
Make sure the IP address listed is the one you set in your `Homestead.yaml` file. Once you have added the domain to your `hosts` file, you can access the site via your web browser!
123+
Make sure the IP address listed is the one set in your `~/.homestead/Homestead.yaml` file. Once you have added the domain to your `hosts` file, you can access the site via your web browser:
158124

159125
http://homestead.app
160126

@@ -168,7 +134,7 @@ To destroy the machine, you may use the `vagrant destroy --force` command.
168134
<a name="per-project-installation"></a>
169135
### Per Project Installation
170136

171-
Instead of installing Homestead globally and sharing the same Homestead box across all of your projects, you may instead configure a Homestead instance for each specific project. Installing Homestead per project may be beneficial if you wish to ship a `Vagrantfile` directly within your project, allowing others working on the project to simply `vagrant up`.
137+
Instead of installing Homestead globally and sharing the same Homestead box across all of your projects, you may instead configure a Homestead instance for each project you manage. Installing Homestead per project may be beneficial if you wish to ship a `Vagrantfile` with your project, allowing others working on the project to simply `vagrant up`.
172138

173139
To install Homestead directly into your project, require it using Composer:
174140

@@ -189,28 +155,35 @@ Next, run the `vagrant up` command in your terminal and access your project at `
189155
<a name="daily-usage"></a>
190156
## Daily Usage
191157

158+
<a name="accessing-homestead-globally"></a>
159+
### Accessing Homestead Globally
160+
161+
Sometimes you may want to `vagrant up` your Homestead machine from anywhere on your filesystem. You can do this by adding a simple Bash alias to your Bash profile. This alias will allow you to run any Vagrant command from anywhere on your system and will automatically point that command to your Homestead installation:
162+
163+
alias homestead='function __homestead() { (cd ~/Homestead && vagrant $*); unset -f __homestead; }; __homestead'
164+
165+
Make sure to tweak the `~/Homestead` path in the alias to the location of your actual Homestead installation. Once the alias is installed, you may run commands like `homestead up` or `homestead ssh` from anywhere on your system.
166+
192167
<a name="connecting-via-ssh"></a>
193168
### Connecting Via SSH
194169

195170
You can SSH into your virtual machine by issuing the `vagrant ssh` terminal command from your Homestead directory.
196171

197-
But, since you will probably need to SSH into your Homestead machine frequently, consider creating an "alias" on your host machine to quickly SSH into the Homestead box. Once you create this alias, you can simply use the "vm" command to SSH into your Homestead machine from anywhere on your system:
198-
199-
alias vm="ssh [email protected] -p 2222"
172+
But, since you will probably need to SSH into your Homestead machine frequently, consider adding the "alias" described above to your host machine to quickly SSH into the Homestead box.
200173

201174
<a name="connecting-to-databases"></a>
202175
### Connecting To Databases
203176

204-
A `homestead` database is configured for both MySQL and Postgres out of the box. For even more convenience, Laravel's `local` database configuration is already set to use this database by default.
177+
A `homestead` database is configured for both MySQL and Postgres out of the box. For even more convenience, Laravel's `.env` file configures the framework to use this database out of the box.
205178

206-
To connect to your MySQL or Postgres database from your host machine via Navicat or Sequel Pro, you should connect to `127.0.0.1` and port 33060 (MySQL) or 54320 (Postgres). The username and password for both databases is `homestead` / `secret`.
179+
To connect to your MySQL or Postgres database from your host machine via Navicat or Sequel Pro, you should connect to `127.0.0.1` and port `33060` (MySQL) or `54320` (Postgres). The username and password for both databases is `homestead` / `secret`.
207180

208-
> **Note:** You should only use these non-standard ports when connecting to the databases from your host machine. You will use the default 3306 and 5432 ports in your Laravel database configuration file since Laravel is running _within_ the Virtual Machine.
181+
> **Note:** You should only use these non-standard ports when connecting to the databases from your host machine. You will use the default 3306 and 5432 ports in your Laravel database configuration file since Laravel is running _within_ the virtual machine.
209182
210183
<a name="adding-additional-sites"></a>
211184
### Adding Additional Sites
212185

213-
Once your Homestead environment is provisioned and running, you may want to add additional Nginx sites for your Laravel applications. You can run as many Laravel installations as you wish on a single Homestead environment. To add an additional site, simply add the site to your `Homestead.yaml` file and then run the `vagrant provision` terminal command from your Homestead directory.
186+
Once your Homestead environment is provisioned and running, you may want to add additional Nginx sites for your Laravel applications. You can run as many Laravel installations as you wish on a single Homestead environment. To add an additional site, simply add the site to your `~/.homestead/Homestead.yaml` file and then run the `vagrant provision` terminal command from your Homestead directory.
214187

215188
<a name="configuring-cron-schedules"></a>
216189
### Configuring Cron Schedules
@@ -248,11 +221,6 @@ If you wish, you may forward additional ports to the Vagrant box, as well as spe
248221
to: 777
249222
protocol: udp
250223

251-
<a name="bash-aliases"></a>
252-
### Bash Aliases
253-
254-
To add additional Bash aliases to your Homestead box, edit the `aliases` file in your Homestead directory. These aliases will automatically be defined on the Homestead box when it starts.
255-
256224
<a name="blackfire-profiler"></a>
257225
## Blackfire Profiler
258226

0 commit comments

Comments
 (0)