Skip to content
This repository was archived by the owner on Feb 18, 2023. It is now read-only.

Commit 8a24c0e

Browse files
committed
Include a VM
1 parent e07acc3 commit 8a24c0e

File tree

5 files changed

+79
-1
lines changed

5 files changed

+79
-1
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
.vagrant/
12
/vendor
23
/node_modules
34
Homestead.yaml

Homestead.yaml.example

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
---
2+
ip: "192.168.10.10"
3+
memory: 2048
4+
cpus: 1
5+
hostname: laravel-api
6+
name: laravel-api
7+
provider: virtualbox
8+
version: 0.3.3
9+
10+
authorize: ~/.ssh/id_rsa.pub
11+
12+
keys:
13+
- ~/.ssh/id_rsa
14+
15+
folders:
16+
- map: "/Users/josefonseca/Documents/Code/laravel-api"
17+
to: "/home/vagrant/laravel-api"
18+
19+
sites:
20+
- map: homestead.app
21+
to: "/home/vagrant/laravel-api/public"
22+
23+
databases:
24+
- homestead
25+
26+
# blackfire:
27+
# - id: foo
28+
# token: bar
29+
# client-id: foo
30+
# client-token: bar
31+
32+
# ports:
33+
# - send: 50000
34+
# to: 5000
35+
# - send: 7777
36+
# to: 777
37+
# protocol: udp

Vagrantfile

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
require 'json'
2+
require 'yaml'
3+
4+
VAGRANTFILE_API_VERSION ||= "2"
5+
confDir = $confDir ||= File.expand_path("vendor/laravel/homestead", File.dirname(__FILE__))
6+
7+
homesteadYamlPath = "Homestead.yaml"
8+
homesteadJsonPath = "Homestead.json"
9+
afterScriptPath = "after.sh"
10+
aliasesPath = "aliases"
11+
12+
require File.expand_path(confDir + '/scripts/homestead.rb')
13+
14+
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
15+
16+
if File.exists? aliasesPath then
17+
config.vm.provision "file", source: aliasesPath, destination: "~/.bash_aliases"
18+
end
19+
20+
if File.exists? homesteadYamlPath then
21+
Homestead.configure(config, YAML::load(File.read(homesteadYamlPath)))
22+
elsif File.exists? homesteadJsonPath then
23+
Homestead.configure(config, JSON.parse(File.read(homesteadJsonPath)))
24+
end
25+
26+
if File.exists? afterScriptPath then
27+
config.vm.provision "shell", path: afterScriptPath
28+
end
29+
end

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@
3131
"phpunit/phpunit": "~4.0",
3232
"phpspec/phpspec": "~2.1",
3333
"scrutinizer/ocular": "~1.1",
34-
"barryvdh/laravel-ide-helper": "2.1.*"
34+
"barryvdh/laravel-ide-helper": "2.1.*",
35+
"laravel/homestead": "^3.0"
3536
},
3637
"autoload": {
3738
"classmap": [

readme.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,16 @@ php artisan migrate
5959

6060
You should be done with the basic configuration.
6161

62+
## Homestead VM
63+
64+
The Laravel API ships with a Homestead VM that you can use as your development environment.
65+
66+
- Create a `Homestead.yaml` file based on `Homestead.yaml.example` and modify it to suit your needs.
67+
- Run `vagrant up` from the project root to initialize the VM.
68+
- Don't forget to update your hosts file to point the domain to the Homestead machine.
69+
70+
For more information about Homestead visit the official documentation [https://laravel.com/docs/5.2/homestead#per-project-installation](https://laravel.com/docs/5.2/homestead#per-project-installation)
71+
6272
## oAuth 2 Authentication server
6373

6474
The started kit has already implemented the oAuth2 server bridge package for League/oAuth2 which means you get API authentication out of the box

0 commit comments

Comments
 (0)