Skip to content

Instantly share code, notes, and snippets.

@hawkup
Last active December 5, 2015 20:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hawkup/0bcd0b84eb59a7f892ca to your computer and use it in GitHub Desktop.
Save hawkup/0bcd0b84eb59a7f892ca to your computer and use it in GitHub Desktop.
Develop_Laravel

Install Homestead

install VirtualBox
install Vagrant
vagrant box add laravel/homestead
git clone https://github.com/laravel/homestead.git Homestead
cd Homestead
bash init.sh

Installation Homestead PHP 7

git clone -b php-7 https://github.com/laravel/homestead.git Homestead7
# if you already have ~/.homestead no need to run bash init.sh
bash init.sh
# add this line on top of ~/.homestead/Homestead.yaml file
box: laravel/homestead-7
# then run vagrant up

Config

# config file stay in ~/.homestead/Homestead.yaml
# set provider
provider: virtualbox

# generate SSH key
ssh-keygen -t rsa -C "you@homestead"

# sync folder
# map 
# to [Virtual]
folders:
    - map: ~/Code
      to: /home/vagrant/Code
      
# config nginx site
sites:
    - map: homestead.app
      to: /home/vagrant/Code/Laravel/public

set hosts file

vim /etc/hosts
# set 192.168.10.10  homestead.app
# can access http://homestead.app

Launch Project

cd Homestead
vagrant up

Destory Vagrant

vagrant destroy --force

Create Laravel project

vagrant ssh
cd Code
laravel new {project}

Per Project Homestead

cd {project}
composer require laravel/homestead --dev
php vendor/bin/homestead make
vagrant up
# add this line on top of Homestead.yaml in project folder (under ---)
box: laravel/homestead-7

Mysql

cd {project}
vagrant ssh
mysql -uroot -p
# username homestead password secret

Start Dev

mysql -uroot -p
mysql > CREATE DATABASE {name};
php artisan key:generate (see .env)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment