We've decided to create a simple vagrant box with all the required packages to improve the environment setup step in our free Getting Started with CakePHP training session. We used other tools in the past, but we hope vagrant will help users to install a common environment before the session to get the most of it.
Requirements
- VirtualBox : https://www.virtualbox.org/wiki/Downloads
- Vagrant : https://www.vagrantup.com/downloads.html
Setup
- Create a new folder where the code will be located
- Create a new file called Vagrantfile with the following contents
# -*- mode: ruby -*- # vi: set ft=ruby : Vagrant.configure("2") do |config| config.vm.box = "cakedc/cakephp-training" config.vm.network :forwarded_port, guest: 8765, host: 8765 config.vm.provider "virtualbox" do |vb| vb.memory = "1024" vb.customize ['modifyvm', :id, '--cableconnected1', 'on'] end end
-
Run vagrant up
- Wait (download could take several minutes depending on your internet connection)
-
Run vagrant ssh
Now you have ssh access to a training ubuntu (16.04) based virtual machine, with all the requirements to run your training CakePHP application.
- Setup a new CakePHP project
cd /vagrant
composer create-project cakephp/app
- Start the local server
cd /vagrant/app
php bin/cake.php server --host 0.0.0.0
- From your host machine, open a browser and navigate to http://localhost:8765
- You should be able to see the CakePHP welcome page
We think this VM will enable faster environment setups, and an easier entry point to the training session. Please let us know if you find issues with this process.