Video Lesson: Set up a docker-magento project in PhpStorm and Docker

Set up a docker-magento project in PhpStorm and Docker

Learn how to configure a PHP project in an IDE to use a Docker Compose development environment.


Lesson Content

Let’s set up a docker-magento project in PhpStorm.

After PhpStorm loads, click New Project. Set the project location to the directory where you installed docker-magento. For example:

~/Sites/magento/src

Make sure the project root is the src folder. This makes future configuration, including development URN mappings, work correctly.

Create the project. Because the directory already contains files, PhpStorm asks how you want to proceed. Select Create from existing sources.

PhpStorm takes a few moments to index the Magento project because it contains many files. If PhpStorm displays prompts in the bottom-right corner, close them for now.

Next, open PhpStorm -> Preferences. Under PHP, set the Language Level to the PHP version used by your Magento installation. For Magento 2.4.3-p1, select PHP 7.4.

The CLI Interpreter setting currently shows none. Click the three-dot button to configure one, then create a new interpreter from Docker.

Select Docker Compose. You may already have a Docker server configured. If you don’t, click New, select Docker for Mac or the Docker daemon you use, and confirm that PhpStorm displays Connection successful. Name the server Docker.

Open the configuration file selector and add the two Compose files from the project root:

  • docker-compose.yml

  • docker-compose.dev.yml

Hold Shift while selecting the files so you can choose both, then click Open.

After both files appear in the configuration, click OK. In the Service dropdown, select phpfpm, then click OK again.

PhpStorm detects the PHP version and configuration file. This confirms that the Docker Compose interpreter is configured correctly. Click OK, then click OK again to close Preferences.

PhpStorm is now configured to work with your docker-magento project through Docker.

Maggie

Hey, I'm Maggie! 👋

Ask me anything.

Want to chat with Maggie?

Log in for AI tutor access.

Comments

Join the discussion!

Notes

Keep track of what you learn!