- Unix environment: MacOS or any Linux distribution
- you should be comfortable with terminal
- basic Git knowledge
What Is Torch Anyway
Torch is lightweight Vagrant box (below 500MB) based on Ubuntu OS, with PHP and Apache as a HTTP server. It was initially created for in-house development. After many hours using it, we decided - why not share it publicly. Hope some of you will find it useful.
You can find more info on official github repository.
Setup Torch Vagrant Box
If you do not have vagrant boxes dir yet, create one in your user home directory
mkdir ~/vagrant-boxes # ... go to box dir cd ~/vagrant-boxes
From there, clone Torch GitHub repo
git clone https://github.com/movor/torch.git # ... and navigate to created directory cd torch
For this tutorial we'll use Torch version v0.1. It has PHP 7.0.30 preinstalled and it's compatible with Laravel 5.5.
You can find more about version compatibility and Torch project itself on official Torch GitHub Repo Checkout "Compatibility" section and find about versions support and compatibility
Let's switch to branch
0.1 for the corresponding Torch version (
git checkout 0.1
Here, you'll need to edit
Vagrantfile with your favorite editor, mine is Vim
Luckily, there is only one line you'll need to uncomment and change
# config.vm.synced_folder "~/Development/web", "/var/www", :mount_options => ["dmode=777", "fmode=777"]
Actually, only "~/Develompent/web" needs to be replaced by your web projects dir.
If you do not have projects dir yet, let's create it with
After changing the
Vagrantfile accordingly, the line should look like one bellow
config.vm.synced_folder "~/webdev", "/var/www", :mount_options => ["dmode=777", "fmode=777"]
Torch will mount this directory internally to
/var/www, so every project you have in there will be accessible from within this box and Apache can serve them all - directly to your browser.
Setup Host Locally
Let's assume that we want to access our Laravel project by typing
http://laravel.loc in the browser. For that we'll need to do 2 things.
Append line to
/etc/hosts file on local machine with
echo "192.168.11.11 laravel.loc" | sudo tee -a /etc/hosts
Light The Torch
Lets start Torch Vagrant box. This will take some time, as box needs to be downloaded and started.
After box has been started, type
and we're in.
Setting Up Laravel 5.5
Navigate to web directory within our Torch box (this will correspond to
~/webdev) directory on our host machine. From here, we need to clone Laravel 5.5.
Cloning Laravel From Github
cd /var/www git clone --single-branch -b 5.5 https://github.com/laravel/laravel.git cd laravel
Let's install PHP dependencies using
Setting Up Environment File
cp .env.example .env
Torch is compatible with default Laravel installation so corresponding user and database
homesteadhas already been pre-set in the box, thus, for now there is no need to edit .env file
Generate key for our application
php artisan key:generate
Browse The Project
Now let's open our favorite browser and navigate to
Don't forget to prefix url with
http://or most browsers will take you to the google search page for
It should display Laravel project default welcome page.
Interact With The Database
Let's make sure our environment and Laraver project is fully functional and can read and write form the database.
For this purpose we'll generate basic authentication scaffolding provided by Laravel.
Before we continue we should run default migrations. They'll create 3 tables:
php artisan migrate
Finally, run the artisan command which will take care of generating auth scaffolding.
php artisan make:auth
If we visit our project url again -
http://larave.loc, in the upper right corner there should be "LOGIN" and "REGISTER" links.
Clicking on "REGISTER" will take us to user registration page created by scaffolding command and there we can register our users.
User registration and login should go smoothly. This means that we successfully set up whole Laravel project.