Vagrant and PHPStorm
Vagrant and PHPStorm
We published a Vagrant Setup that provides you with a basic Ubuntu 16.04 that contains everything that you needed to develop with Shopware.
It contains the Apache2 Web Server, MySQL Server as well as all required tools, like
Please note that Vagrant setup does not contain a Shopware installation. The installation has to be done manually.
Download the required software:
Additional Information for VirtualBox setup (Windows), or you get errors like "error downloading the file" without any further explanation:
- make sure VirtualBox supports 64bit Guest Systems, if only 32 bit is supported check if:
- your host OS is a 64 bit system
- Intel Virtualization Technology and VT-d are both(!) enabled
- the Hyper-V platform is disabled in the Windows Features list
The provisioning is done directly on your new virtual machine by Ansible.
1. Clone the repository to your local machine
$ git clone https://github.com/shopwareLabs/shopware-vagrant $ cd shopware-vagrant
2. Boot up your Vagrant virtual machine
$ vagrant up
The first boot may take a while. After that, your machine will be available at http://192.168.33.10/. All required tools like the LAMP stack are already installed.
- Adminer (DB-Administration): http://192.168.33.10/adminer.php
- MySQL user:
3. SSH access
The SSH username is
vagrant, the password:
vagrant. To automatically SSH into the created VM run
vagrant ssh. If you use Putty, the SSH configuration can be obtained via:
$ vagrant ssh-config
Benefits of using PhpStorm
- Intelligent PHP editor
- PHP code completion
- Integrated refactoring
- Smarty and PHPDoc support
- Easy installation
- Cross platform
- Individual project settings
- Visual PHPUnit test runner
- VCS support
- Local history
- FTP and remote synchronization
- Visual debugging inside the IDE
- HTML5 and CSS editor including zen coding
Install the Shopware Plugin
The official Shopware plugin is available in the global jetbrains repository and can therefore be installed right inside your editor. It depends on the Symfony2 plugin which will automatically be installed during the installation of the Shopware plugin. You can read more about its features on the official plugin page.
Exclude Directories from Indexing
PhpStorm provides you with a variant of automatic code completions. First, PhpStorm needs to index all files inside your Project. This might take a while, depending on the number and size of files in your project.
To exclude directories from indexing, open the Settings and select Directories in the left sidebar. You can now select directories on the right side and mark them as excluded by clicking on Excluded above.
The following directories (if existing) should be excluded:
These directories will be marked red in your project and might not be visible anymore, but they will still remain on your hard drive.
Deploy with PhpStorm
To deploy a locally installed project to the Vagrant server, you need to configure auto deployment in PhpStorm. Make sure you are using the developer version of Shopware which can be downloaded from GitHub.
git clone https://github.com/shopware/shopware.git
Open your Shopware project in PhpStorm.
Choose in your toolbar
Now we add our new Vagrant machine as deployment target.
Choose a unique name and the "SFTP" type.
Fill in all required fields.
- SFTP host:
- Root Path:
- User name:
- Save Password:
- Web server root URL:
Now press OK to save your settings. If you configured your deployment machine successfully, you will now be asked to add the RSA key to your known hosts. Press Yes. After that, you should get a success message.
After adding your deploy machine, you have to create a mapping between the local and remote files.
Switch to the Mappings directory and press the "..." near
Deployment path. Choose
/home/vagrant/www/shopware. If the shopware directory doesn't exists, create it here with a right click.
Now press OK and close all deployment windows, so that you are back in your default IDE view.
Right click on your document root directory and click on
Upload to Vagrant Deployment
You can enable the automatic upload function so you don't have manually upload your files every time you change them:
Tools > Deployment > Automatic Upload.
Now that we uploaded Shopware onto the Vagrant box, we have to configure and install the development edition of Shopware.
1. Connect to your Vagrant Machine
Connect to your Vagrant machine via ssh using the
vagrant ssh command
$ vagrant ssh $ cd /home/vagrant/www/shopware/build
2. Configure your build properties
$ ant configure
- db name:
- db username:
- db password:
- app host:
- app path:
After you get the
BUILD SUCCESSFUL message you can run the full build command.
$ ant build-unit
3. Test images
Download the test images and extract them into your Shopware's root directory.
$ cd .. $ wget -O test_images.zip http://releases.s3.shopware.com/test_images.zip $ unzip test_images.zip $ php bin/console sw:media:migrate $ php bin/console sw:thumbnail:generate
Your Shopware installation is now complete and can be accessed at http://192.168.33.10/shopware.
To open the backend, add
/backend to your URL so it becomes http://192.168.33.10/shopware/backend. You can then login using the default user credentials demo/demo.