- Ubuntu 18.04
- PHP 7.4
- Composer 2
- xDebug
- htop
- mc (Midnight Commander)
-
Install VirtualBox
-
Install Vagrant
-
Create GitHub personal API token
-
Prepare project:
git clone https://github.com/yiisoft/yii-dev-tool.git cd yii-dev-tool/vagrant/config cp vagrant-local.example.yml vagrant-local.yml
-
Place your GitHub personal API token to
vagrant-local.yml
, also specify your name and email for git commits -
Change directory to project root:
cd yii-dev-tool
-
Run command:
vagrant up
That's all. You just need to wait for completion!
-
Install VirtualBox
-
Install Vagrant
-
Reboot
-
Create GitHub personal API token
-
Prepare project:
- download repo yiisoft/yii-dev-tool
- unzip it
- go into directory
yii-dev-tool-master/vagrant/config
- copy
vagrant-local.example.yml
tovagrant-local.yml
-
Place your GitHub personal API token to
vagrant-local.yml
, also specify your name and email for git commits -
Open terminal (
cmd.exe
), change directory to project root and run command:vagrant up
(You can read here how to change directories in command prompt)
That's all. You just need to wait for completion!
Now you can login by SSH to the created virtual machine:
vagrant ssh
After that, you can use the commands of yii-dev-tool on the machine as usual. For example:
./yii-dev install di,rbac,yii-cycle,view
Sometimes some composer plugins do not work during virtualization.
In this case use flag --no-plugins
when installing and updating packages. For example:
./yii-dev install --no-plugins di,rbac,yii-cycle,view
Update example:
./yii-dev update --no-plugins injector,cache,log,proxy
Our vagrant environment automatically uses SSH keys from the host machine. Therefore, you do not need to separately generate keys for the guest machine. Just make sure the keys from your host machine are added to your list of keys on GitHub. This is necessary in order to access remote repositories via SSH protocol.
The bash history of the virtual machine is automatically saved to file yii-dev-tool/vargant/history/.bash_history
– this allows you to not lose history between recreations of the machine.
Our Vagrant environment contains already configured xDebug. You need to configure only your IDE.
- Go to PHPStorm
Settings > Languages & Frameworks > PHP > Servers
- Add server with following parameters:
- Name:
console
(same asserverName=
inyii-dev-tool/debug
script) - Host, port: set vagrant box IP (
192.168.135.48
by default) and port80
- Debugger: Xdebug
- [v] Use path mappings
- Map your project root in host to relative dir in guest (for example,
/Users/Alex/Projects/yii-dev-tool
to/yii-dev-tool
) - Hit OK
- Name:
- Click
PHPStorm > Run > Start listening for PHP Debug Connections
- Do not forget to put a breakpoint somewhere!
-
Go to guest machine:
vagrant ssh
-
Run some PHP script prefixed with
yii-dev-tool/debug
script. For example:cd /yii-dev-tool ./debug ./yii-dev
-
Debugger window should open in PhpStorm
-
Enjoy! :)