In the following write-up, we are going to discuss the types of software and associated components that are used for developing applications with ‘Laravel 5.1’. We will also learn about those instructions that one needs to follow for installing Vagrant and Virtual Box.

Advent of Virtual Machines

Over the past few years, virtual machines have managed to gain incredible recognition. Known as VMs, they allow a single computer system, typically the host OS (operating system) in order to emulate or imitate another one. Although virtual machines have been around the corner for a while now, at present owing to the increase in processor speed and ready availability of cheap memory, they can be found on the desktop of every random developer.

Laravel has embraced the VM technology and packed its ‘box’ with commonly needed web applications. This developmental environment is known as Laravel Homestead.

What is Laravel Homestead?

The chief objective of Laravel is to simplify the overall procedure of PHP development and make it entertaining at the same time. Thus, Laravel offers a ‘pre-packaged development environment’ known as Laravel Homestead. Vagrant is there to manage all virtual machines and the Virtual Box provides a suitable interface to the host OS.

We can use the example of a car to explain how all these components work together properly. Homestead could be referred to as the driver’s seat, Vagrant is the outer frame of the car and Virtual Box is the engine. Once you have installed the Virtual Box and Vagrant, all the worries come to an end. All other sorts of interactions with the virtual machine are carried on through the Homestead. (just like when the car starts, all the responsibility comes upon the driver and we do not pay much attention to either the frame or the engine).

By using Laravel Homestead, you would get the opportunity of using a virtual ‘Ubuntu Linux Machine’, installed with software that helps in web development. This VM includes the following:

  • Ubuntu 14.04
  • PHP 5.6
  • Nginx
  • MySQL
  • Redis
  • HHVM
  • PostgresSQL
  • Node along with Bower, Grunt, and Gulp
  • Beanstalked
  • Memcached
  • Extension of Fabric+HipChat
  • Laravel Envoy

The best thing about Homestead and Vagrant is that they allow a development environment, which can be used on diverse platforms starting from Windows to OS X and Linux systems. You can flush out the worries about conflicting software that might hamper the host machine.

How to Install Virtual Box?

Vagrant needs a backend provider in order to manage the concerned virtual machine. If you do have a Virtual Box, VMWare or any other compatible provider, just skip this step. However, if you do not have a backend, install the Virtual Box. It can work on all the major platforms and is free.

You can log on to www.virtualbox.org for downloading and installing the package that is compatible with your operating system.

How to Install Vagrant?

Once you have installed a Virtual Box or any other backend provider, proceed further to install Vagrant.

Log on to www.vagrantup.com for downloading and installing.

After you have installed Vagrant, reboot your machine. After that verify the installation of Vagrant by clicking on console (the command prompt present in Windows or the terminal in Linux and OS X). Make sure to check the version.

How to Check the Vagrant?

Where to Implement all these Things?

Now after going through the above-mentioned discussion, I am sure the readers are wondering- ‘where do I run this?’ Well, now let us explore the Laravel development’s major components that are integrated within Homestead. This would surely answer the stated question.

  • Web Server runs in ‘Homestead VirtualMachine’. Nginx is used for serving the web pages. The host operating system can access all the web pages by utilizing port (80) of standard HTTP at a specific address of 192.168.10.10. Another address for port 8000 is 127.0.0.1.
  • It is necessary to edit the source code from host OS. The edited files could be found in ‘Homestead Virtual Machine’ through the shared folders.
  • MySQL can be accessed from the host OS by inputting the following information:

Setting Name

Setting Value

Host

127.0.0.1

Port

33060

Username

homestead

Password

secret

 

  • Memcached also runs with the same virtual machine and is actually a value cache or in-memory key.
  • Beanstalked is a fast and simple work queue, which runs within the same virtual machine.
  • Git or Subversion are run from the host OS. Although it can be run from other platforms but users are recommended to use the host operating system. Running them on a single location consistently would surely let you avoid potential conflicts.

For example, you have installed subversion along with its version 1.8 in your Homestead virtual machine. Check the source code from the virtual machine and then again from the host OS. If the subversion is installed in host OS, you would not be able to do anything unless you upgrade the subversion on the same platform.

  • Bower is a simple package manager that could also be run from both Host OS and virtual machine.
  • Gulp is a build system of Laravel Elixir and is used to concatenate, minify, combine, copy and automate the assets. It runs only on host OS. Running Gulp from the host OS is important from Windows. For Linux and OS X, the Gulp could provide some growling notifications.
  • Composer can also run in host OS. If your operating system is Windows, then the composer would create some essential batch files that are required for correct functioning.
  • Artisan should be run only from the ‘Homestead Virtual Machine’. The chief reason is that any database, cache drivers or queue are installed in the Homestead only. It may not be available in host OS.

I hope all my readers found this entire article helpful. Now they can use this information to make their decision about Laravel Homestead.

An Ultimate Guide to Laravel 5.1 and its Associated Software
Tagged on:

Leave a Reply

Your email address will not be published. Required fields are marked *